diff options
| author | James Turnbull <james@lovedthanlost.net> | 2009-05-27 22:49:16 +1000 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-05-27 22:49:16 +1000 |
| commit | 3ec3f915306dac13370f64795c399df97fc2d992 (patch) | |
| tree | c8c409137c5cdccccd1b68c6d14b3ec2602dd1b9 /spec/unit | |
| parent | f98d49f2d20ed52cd33504c5d0ef97d0edf9107f (diff) | |
| download | puppet-3ec3f915306dac13370f64795c399df97fc2d992.tar.gz puppet-3ec3f915306dac13370f64795c399df97fc2d992.tar.xz puppet-3ec3f915306dac13370f64795c399df97fc2d992.zip | |
Fixed #2280 - Detailed exit codes fix
Diffstat (limited to 'spec/unit')
| -rw-r--r-- | spec/unit/application/puppet.rb | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/spec/unit/application/puppet.rb b/spec/unit/application/puppet.rb index 0fbfbe591..9256b00dc 100644 --- a/spec/unit/application/puppet.rb +++ b/spec/unit/application/puppet.rb @@ -274,7 +274,7 @@ describe "Puppet" do it "should generate a report if not noop" do Puppet.stubs(:[]).with(:noop).returns(false) - @puppet.options.stubs(:[]).with(:detailed_exits).returns(true) + @puppet.options.stubs(:[]).with(:detailed_exitcodes).returns(true) metrics = stub 'metrics', :[] => { :total => 10, :failed => 0} report = stub 'report', :metrics => metrics @transaction.stubs(:report).returns(report) @@ -284,6 +284,40 @@ describe "Puppet" do @puppet.main end + describe "with detailed_exitcodes" do + before :each do + Puppet.stubs(:[]).with(:noop).returns(false) + @puppet.options.stubs(:[]).with(:detailed_exitcodes).returns(true) + end + + it "should exit with exit code of 2 if changes" do + report = stub 'report', :metrics => { "changes" => {:total => 1}, "resources" => {:failed => 0} } + @transaction.stubs(:generate_report).returns(report) + @transaction.stubs(:report).returns(report) + @puppet.expects(:exit).with(2) + + @puppet.main + end + + it "should exit with exit code of 4 if failures" do + report = stub 'report', :metrics => { "changes" => {:total => 0}, "resources" => {:failed => 1} } + @transaction.stubs(:generate_report).returns(report) + @transaction.stubs(:report).returns(report) + @puppet.expects(:exit).with(4) + + @puppet.main + end + + it "should exit with exit code of 6 if changes and failures" do + report = stub 'report', :metrics => { "changes" => {:total => 1}, "resources" => {:failed => 1} } + @transaction.stubs(:generate_report).returns(report) + @transaction.stubs(:report).returns(report) + @puppet.expects(:exit).with(6) + + @puppet.main + end + end + end end |
