diff options
| author | Paul Berry <paul@puppetlabs.com> | 2010-12-16 16:23:34 -0800 |
|---|---|---|
| committer | Paul Berry <paul@puppetlabs.com> | 2010-12-17 11:02:12 -0800 |
| commit | 4d3030c6dd67dcb1f6116e7e3d09ddcd20ee726b (patch) | |
| tree | e62d0db3e04e0c3ebbfd806cc9966ac67ab0eff9 /spec/unit/resource | |
| parent | 7fff7808e25491a5ea1e207b8de3ade0c4f95f4f (diff) | |
| download | puppet-4d3030c6dd67dcb1f6116e7e3d09ddcd20ee726b.tar.gz puppet-4d3030c6dd67dcb1f6116e7e3d09ddcd20ee726b.tar.xz puppet-4d3030c6dd67dcb1f6116e7e3d09ddcd20ee726b.zip | |
Modified the behavior of Puppet::Resource::Status as follows:
- #change_count now only counts events that represent successful
changes. It does not count failures, audits, or noops.
- #changed is equivalent to #change_count > 0.
- #out_of_sync_count (a new attribute) counts all events except audits.
- #out_of_sync is equivalent to #out_of_sync_count > 0.
This should hopefully make the summary statistics in reports more useful.
Diffstat (limited to 'spec/unit/resource')
| -rwxr-xr-x | spec/unit/resource/status_spec.rb | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/spec/unit/resource/status_spec.rb b/spec/unit/resource/status_spec.rb index 7a21164c3..bda8aea00 100755 --- a/spec/unit/resource/status_spec.rb +++ b/spec/unit/resource/status_spec.rb @@ -101,8 +101,8 @@ describe Puppet::Resource::Status do @status.events.should == [event] end - it "should count the number of events and set changed" do - 3.times{ @status << Puppet::Transaction::Event.new } + it "should count the number of successful events and set changed" do + 3.times{ @status << Puppet::Transaction::Event.new(:status => 'success') } @status.change_count.should == 3 @status.changed.should == true @@ -115,4 +115,24 @@ describe Puppet::Resource::Status do @status.changed.should be_false @status.out_of_sync.should be_false end + + it "should not treat failure, audit, or noop events as changed" do + ['failure', 'audit', 'noop'].each do |s| @status << Puppet::Transaction::Event.new(:status => s) end + @status.change_count.should == 0 + @status.changed.should be_false + end + + it "should not treat audit events as out of sync" do + @status << Puppet::Transaction::Event.new(:status => 'audit') + @status.out_of_sync_count.should == 0 + @status.out_of_sync.should be_false + end + + ['failure', 'noop', 'success'].each do |event_status| + it "should treat #{event_status} events as out of sync" do + 3.times do @status << Puppet::Transaction::Event.new(:status => event_status) end + @status.out_of_sync_count.should == 3 + @status.out_of_sync.should == true + end + end end |
