~ubuntu-branches/ubuntu/wily/puppet/wily-proposed

« back to all changes in this revision

Viewing changes to spec/unit/application/master_spec.rb

  • Committer: Package Import Robot
  • Author(s): Stig Sandbeck Mathisen
  • Date: 2014-10-24 13:47:15 UTC
  • mfrom: (3.1.64 sid)
  • Revision ID: package-import@ubuntu.com-20141024134715-6ig54u0c4gar36ss
Tags: 3.7.2-1
* Imported upstream release 3.7.2
* Declare compliance with Debian Policy 3.9.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
      expect { @master.setup }.to raise_error(Puppet::Error, /Puppet master is not supported on Microsoft Windows/)
115
115
    end
116
116
 
117
 
    it "should set log level to debug if --debug was passed" do
118
 
      @master.options.stubs(:[]).with(:debug).returns(true)
119
 
      @master.setup
120
 
      Puppet::Log.level.should == :debug
121
 
    end
122
 
 
123
 
    it "should set log level to info if --verbose was passed" do
124
 
      @master.options.stubs(:[]).with(:verbose).returns(true)
125
 
      @master.setup
126
 
      Puppet::Log.level.should == :info
127
 
    end
128
 
 
129
 
    it "should set console as the log destination if no --logdest and --daemonize" do
130
 
      @master.stubs(:[]).with(:daemonize).returns(:false)
131
 
 
132
 
      Puppet::Log.expects(:newdestination).with(:syslog)
133
 
 
134
 
      @master.setup
135
 
    end
136
 
 
137
 
    it "should set syslog as the log destination if no --logdest and not --daemonize" do
138
 
      Puppet::Log.expects(:newdestination).with(:syslog)
139
 
 
140
 
      @master.setup
141
 
    end
142
 
 
143
 
    it "should set syslog as the log destination if --rack" do
144
 
      @master.options.stubs(:[]).with(:rack).returns(:true)
145
 
 
146
 
      Puppet::Log.expects(:newdestination).with(:syslog)
147
 
 
148
 
      @master.setup
 
117
    describe "setting up logging" do
 
118
      it "sets the log level" do
 
119
        @master.expects(:set_log_level)
 
120
        @master.setup
 
121
      end
 
122
 
 
123
      describe "when the log destination is not explicitly configured" do
 
124
        before do
 
125
          @master.options.stubs(:[]).with(:setdest).returns false
 
126
        end
 
127
 
 
128
        it "logs to the console when --compile is given" do
 
129
          @master.options.stubs(:[]).with(:node).returns "default"
 
130
          Puppet::Util::Log.expects(:newdestination).with(:console)
 
131
          @master.setup
 
132
        end
 
133
 
 
134
        it "logs to the console when the master is not daemonized or run with rack" do
 
135
          Puppet::Util::Log.expects(:newdestination).with(:console)
 
136
          Puppet[:daemonize] = false
 
137
          @master.options.stubs(:[]).with(:rack).returns(false)
 
138
          @master.setup
 
139
        end
 
140
 
 
141
        it "logs to syslog when the master is daemonized" do
 
142
          Puppet::Util::Log.expects(:newdestination).with(:console).never
 
143
          Puppet::Util::Log.expects(:newdestination).with(:syslog)
 
144
          Puppet[:daemonize] = true
 
145
          @master.options.stubs(:[]).with(:rack).returns(false)
 
146
          @master.setup
 
147
        end
 
148
 
 
149
        it "logs to syslog when the master is run with rack" do
 
150
          Puppet::Util::Log.expects(:newdestination).with(:console).never
 
151
          Puppet::Util::Log.expects(:newdestination).with(:syslog)
 
152
          Puppet[:daemonize] = false
 
153
          @master.options.stubs(:[]).with(:rack).returns(true)
 
154
          @master.setup
 
155
        end
 
156
      end
149
157
    end
150
158
 
151
159
    it "should print puppet config if asked to in Puppet config" do