summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-11-01 15:09:43 -0500
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit4be86015bd0a663f9e662186f7acbf8c3c8b421f (patch)
tree9a3ff142336ead0cecc2af9e659a3a6445a992b1 /spec
parent2aa579bdbd91db2cd9a154e0ead2b327fa9a8474 (diff)
Adding Transaction events to Transaction reports
This means that every event generated during a transaction, with all of its metadata, will now be in the report. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/transaction/event_manager.rb17
-rwxr-xr-xspec/unit/transaction/report.rb17
2 files changed, 33 insertions, 1 deletions
diff --git a/spec/unit/transaction/event_manager.rb b/spec/unit/transaction/event_manager.rb
index 96dd37d0a..5503ad380 100755
--- a/spec/unit/transaction/event_manager.rb
+++ b/spec/unit/transaction/event_manager.rb
@@ -20,15 +20,25 @@ 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
- @transaction = stub 'transaction'
@manager = Puppet::Transaction::EventManager.new(@transaction)
@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
@@ -100,6 +110,11 @@ 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 e576f2393..478c941f5 100755
--- a/spec/unit/transaction/report.rb
+++ b/spec/unit/transaction/report.rb
@@ -10,6 +10,11 @@ describe Puppet::Transaction::Report do
Puppet::Transaction::Report.new.host.should == "myhost"
end
+ it "should return its host name as its name" do
+ r = Puppet::Transaction::Report.new
+ r.name.should == r.host
+ end
+
describe "when accepting logs" do
before do
@report = Puppet::Transaction::Report.new
@@ -26,6 +31,18 @@ describe Puppet::Transaction::Report do
end
end
+ describe "when accepting events" 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)
+ end
+ end
+
describe "when using the indirector" do
it "should redirect :find to the indirection" do
@indirection = stub 'indirection', :name => :report