diff options
author | Paul Berry <paul@puppetlabs.com> | 2010-12-29 14:49:16 -0800 |
---|---|---|
committer | Paul Berry <paul@puppetlabs.com> | 2010-12-30 11:53:05 -0800 |
commit | 037eac4383ed5a5e9cdde765b607a180209bad1e (patch) | |
tree | 9c48d7656ab9ba36f9b2110c2b84284d6e997ee7 /spec | |
parent | e4a2e049dc9f77569a2dac042e9e847ef34f037d (diff) | |
download | puppet-037eac4383ed5a5e9cdde765b607a180209bad1e.tar.gz puppet-037eac4383ed5a5e9cdde765b607a180209bad1e.tar.xz puppet-037eac4383ed5a5e9cdde765b607a180209bad1e.zip |
(#5715) Add status attribute to reports.
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/unit/transaction/report_spec.rb | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/spec/unit/transaction/report_spec.rb b/spec/unit/transaction/report_spec.rb index 5d270dad3..96d464b7a 100755 --- a/spec/unit/transaction/report_spec.rb +++ b/spec/unit/transaction/report_spec.rb @@ -121,7 +121,14 @@ describe Puppet::Transaction::Report do end end - describe "when calculating metrics" do + describe "before finalizing the report" do + it "should have a status of 'failed'" do + report = Puppet::Transaction::Report.new("apply") + report.status.should == 'failed' + end + end + + describe "when finalizing the report" do before do @report = Puppet::Transaction::Report.new("apply") end @@ -166,18 +173,26 @@ describe Puppet::Transaction::Report do metric(:resources, state).should == 3 end end + + it "should mark the report as 'failed' if there are failing resources" do + add_statuses(1) { |status| status.failed = true } + @report.finalize_report + @report.status.should == 'failed' + end end describe "for changes" do - it "should provide the number of changes from the resource statuses" do + it "should provide the number of changes from the resource statuses and mark the report as 'changed'" do add_statuses(3) { |status| 3.times { status << Puppet::Transaction::Event.new(:status => 'success') } } @report.finalize_report metric(:changes, :total).should == 9 + @report.status.should == 'changed' end - it "should provide a total even if there are no changes" do + it "should provide a total even if there are no changes, and mark the report as 'unchanged'" do @report.finalize_report metric(:changes, :total).should == 0 + @report.status.should == 'unchanged' end end |