summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@reductivelabs.com>2010-01-19 23:24:24 -0800
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit386b3e567f09c1ff1eb8ba4bb0a4f6432d3fab31 (patch)
treee9793c388ecc72fe18e920a93d57bb7a63529280 /spec
parentfbd5b0a2d67b28c3e9ab0f161c1bcfa918ee0b6e (diff)
downloadpuppet-386b3e567f09c1ff1eb8ba4bb0a4f6432d3fab31.tar.gz
puppet-386b3e567f09c1ff1eb8ba4bb0a4f6432d3fab31.tar.xz
puppet-386b3e567f09c1ff1eb8ba4bb0a4f6432d3fab31.zip
Fixing #2759 - reports now have complete change info
This includes every event generated in the transaction and a Resource::Status object for each resource managed, with per-resource information in it. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/transaction.rb7
-rwxr-xr-xspec/unit/transaction/event_manager.rb16
-rwxr-xr-xspec/unit/transaction/report.rb10
3 files changed, 12 insertions, 21 deletions
diff --git a/spec/unit/transaction.rb b/spec/unit/transaction.rb
index fba2518a5..e2ab00748 100755
--- a/spec/unit/transaction.rb
+++ b/spec/unit/transaction.rb
@@ -29,6 +29,13 @@ describe Puppet::Transaction do
@transaction.resource_status(resource.to_s).should equal(status)
end
+ it "should add provided resource statuses to its report" do
+ resource = Puppet::Type.type(:notify).new :title => "foobar"
+ status = Puppet::Resource::Status.new(resource)
+ @transaction.add_resource_status(status)
+ @transaction.report.resource_statuses[resource.to_s].should equal(status)
+ end
+
it "should return nil when asked for a status that has not been created" do
@transaction.resource_status("File[/foo]").should be_nil
end
diff --git a/spec/unit/transaction/event_manager.rb b/spec/unit/transaction/event_manager.rb
index 5503ad380..7d8fb8afd 100755
--- a/spec/unit/transaction/event_manager.rb
+++ b/spec/unit/transaction/event_manager.rb
@@ -20,15 +20,6 @@ describe Puppet::Transaction::EventManager do
manager.relationship_graph.should == "mygraph"
end
- it "should delegate its report to the transaction" do
- transaction = stub 'transaction'
- manager = Puppet::Transaction::EventManager.new(transaction)
-
- transaction.expects(:report).returns "myreport"
-
- manager.report.should == "myreport"
- end
-
describe "when queueing events" do
before do
@manager = Puppet::Transaction::EventManager.new(@transaction)
@@ -36,9 +27,7 @@ describe Puppet::Transaction::EventManager do
@resource = stub("resource", :self_refresh? => false, :deleting => false)
@graph = stub 'graph', :matching_edges => [], :resource => @resource
- @report = stub 'report', :register_event => nil
@manager.stubs(:relationship_graph).returns @graph
- @manager.stubs(:report).returns @report
@event = Puppet::Transaction::Event.new(:name => :foo, :resource => @resource)
end
@@ -110,11 +99,6 @@ describe Puppet::Transaction::EventManager do
@manager.queue_event(@resource, @event)
end
-
- it "should add each event to the transaction report's event list" do
- @manager.report.expects(:register_event).with(@event)
- @manager.queue_event(@resource, @event)
- end
end
describe "when queueing events for a resource" do
diff --git a/spec/unit/transaction/report.rb b/spec/unit/transaction/report.rb
index 730f83bd4..5be625e1d 100755
--- a/spec/unit/transaction/report.rb
+++ b/spec/unit/transaction/report.rb
@@ -36,15 +36,15 @@ describe Puppet::Transaction::Report do
end
end
- describe "when accepting events" do
+ describe "when accepting resource statuses" do
before do
@report = Puppet::Transaction::Report.new
end
- it "should add each event to its event list" do
- event = stub 'event'
- @report.register_event event
- @report.events.should be_include(event)
+ it "should add each status to its status list" do
+ status = stub 'status', :resource => "foo"
+ @report.add_resource_status status
+ @report.resource_statuses["foo"].should equal(status)
end
end