[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 2.6.5rc1-120-g2247c80
Paul Berry
paul at puppetlabs.com
Mon Feb 7 06:39:56 UTC 2011
The following commit has been merged in the upstream branch:
commit c57a677638db14a4d38144cc18e2055fedca8f5e
Author: Paul Berry <paul at puppetlabs.com>
Date: Fri Jan 7 14:43:57 2011 -0800
Maint: test partial resource failure
Added a resource harness test to verify that the correct events are
generated if there is a failure while synchronizing a resource.
Paired-with: Jesse Wolfe <jesse at puppetlabs.com>
diff --git a/spec/unit/transaction/resource_harness_spec.rb b/spec/unit/transaction/resource_harness_spec.rb
index 65c148a..ca35740 100755
--- a/spec/unit/transaction/resource_harness_spec.rb
+++ b/spec/unit/transaction/resource_harness_spec.rb
@@ -64,6 +64,64 @@ describe Puppet::Transaction::ResourceHarness do
end
end
+ describe "when an error occurs" do
+ before :each do
+ # Create a temporary anonymous class to act as a provider
+ stubProvider = Class.new(Puppet::Type)
+ stubProvider.instance_eval do
+ initvars
+
+ newparam(:name) do
+ desc "The name var"
+ isnamevar
+ end
+
+ newproperty(:foo) do
+ desc "A property that can be changed successfully"
+ def sync
+ end
+
+ def retrieve
+ :absent
+ end
+
+ def insync?(reference_value)
+ false
+ end
+ end
+
+ newproperty(:bar) do
+ desc "A property that raises an exception when you try to change it"
+ def sync
+ raise ZeroDivisionError.new('bar')
+ end
+
+ def retrieve
+ :absent
+ end
+
+ def insync?(reference_value)
+ false
+ end
+ end
+ end
+
+ resource = stubProvider.new :name => 'name', :foo => 1, :bar => 2
+ resource.expects(:err).never
+ @status = @harness.evaluate(resource)
+ end
+
+ it "should record previous successful events" do
+ @status.events[0].property.should == 'foo'
+ @status.events[0].status.should == 'success'
+ end
+
+ it "should record a failure event" do
+ @status.events[1].property.should == 'bar'
+ @status.events[1].status.should == 'failure'
+ end
+ end
+
describe "when applying changes" do
[false, true].each do |noop_mode|; describe (noop_mode ? "in noop mode" : "in normal mode") do
[nil, '750'].each do |machine_state|; describe (machine_state ? "with a file initially present" : "with no file initially present") do
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list