diff options
author | Stig Sandbeck Mathisen <ssm@debian.org> | 2014-09-07 10:14:36 +0200 |
---|---|---|
committer | Stig Sandbeck Mathisen <ssm@debian.org> | 2014-09-07 10:14:36 +0200 |
commit | d4b83be375ac1dead058e091191ee7c7b7c24c8a (patch) | |
tree | dc825687392ae3068de5b764be60c53122d9e02a /spec/unit/application/master_spec.rb | |
parent | 229cbb976fe0f70f5f30548b83517b415840f9bb (diff) | |
parent | 1681684857c6e39d60d87b0b3520d8783977ceff (diff) | |
download | puppet-upstream/3.7.0.tar.gz |
Imported Upstream version 3.7.0upstream/3.7.0
Diffstat (limited to 'spec/unit/application/master_spec.rb')
-rwxr-xr-x | spec/unit/application/master_spec.rb | 62 |
1 files changed, 35 insertions, 27 deletions
diff --git a/spec/unit/application/master_spec.rb b/spec/unit/application/master_spec.rb index 4d3167ce8..ef9c1b174 100755 --- a/spec/unit/application/master_spec.rb +++ b/spec/unit/application/master_spec.rb @@ -114,38 +114,46 @@ describe Puppet::Application::Master, :unless => Puppet.features.microsoft_windo expect { @master.setup }.to raise_error(Puppet::Error, /Puppet master is not supported on Microsoft Windows/) end - it "should set log level to debug if --debug was passed" do - @master.options.stubs(:[]).with(:debug).returns(true) - @master.setup - Puppet::Log.level.should == :debug - end - - it "should set log level to info if --verbose was passed" do - @master.options.stubs(:[]).with(:verbose).returns(true) - @master.setup - Puppet::Log.level.should == :info - end - - it "should set console as the log destination if no --logdest and --daemonize" do - @master.stubs(:[]).with(:daemonize).returns(:false) - - Puppet::Log.expects(:newdestination).with(:syslog) - - @master.setup - end + describe "setting up logging" do + it "sets the log level" do + @master.expects(:set_log_level) + @master.setup + end - it "should set syslog as the log destination if no --logdest and not --daemonize" do - Puppet::Log.expects(:newdestination).with(:syslog) + describe "when the log destination is not explicitly configured" do + before do + @master.options.stubs(:[]).with(:setdest).returns false + end - @master.setup - end + it "logs to the console when --compile is given" do + @master.options.stubs(:[]).with(:node).returns "default" + Puppet::Util::Log.expects(:newdestination).with(:console) + @master.setup + end - it "should set syslog as the log destination if --rack" do - @master.options.stubs(:[]).with(:rack).returns(:true) + it "logs to the console when the master is not daemonized or run with rack" do + Puppet::Util::Log.expects(:newdestination).with(:console) + Puppet[:daemonize] = false + @master.options.stubs(:[]).with(:rack).returns(false) + @master.setup + end - Puppet::Log.expects(:newdestination).with(:syslog) + it "logs to syslog when the master is daemonized" do + Puppet::Util::Log.expects(:newdestination).with(:console).never + Puppet::Util::Log.expects(:newdestination).with(:syslog) + Puppet[:daemonize] = true + @master.options.stubs(:[]).with(:rack).returns(false) + @master.setup + end - @master.setup + it "logs to syslog when the master is run with rack" do + Puppet::Util::Log.expects(:newdestination).with(:console).never + Puppet::Util::Log.expects(:newdestination).with(:syslog) + Puppet[:daemonize] = false + @master.options.stubs(:[]).with(:rack).returns(true) + @master.setup + end + end end it "should print puppet config if asked to in Puppet config" do |