blob: 2b8a5d920c14bd93bf3acbc4ea4e18259f4f967f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../spec_helper'
require 'puppet/transaction'
describe Puppet::Transaction do
it "should not apply generated resources if the parent resource fails" do
catalog = Puppet::Resource::Catalog.new
resource = Puppet::Type.type(:file).new :path => "/foo/bar", :backup => false
catalog.add_resource resource
child_resource = Puppet::Type.type(:file).new :path => "/foo/bar/baz", :backup => false
resource.expects(:eval_generate).returns([child_resource])
transaction = Puppet::Transaction.new(catalog)
resource.expects(:evaluate).raises "this is a failure"
child_resource.expects(:evaluate).never
transaction.evaluate
end
it "should not apply exported resources" do
catalog = Puppet::Resource::Catalog.new
resource = Puppet::Type.type(:file).new :path => "/foo/bar", :backup => false
resource.exported = true
catalog.add_resource resource
transaction = Puppet::Transaction.new(catalog)
resource.expects(:evaluate).never
transaction.evaluate
end
end
|