summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-02-12 14:57:24 -0600
committerLuke Kanies <luke@madstop.com>2008-02-12 14:57:24 -0600
commit7e45553448f2a051594ee4f2fc83ebcfa4a8114a (patch)
tree1d64489aa420ee391fb0fe51673fad92232bdcc6 /spec/unit/parser
parent9b66251076e0403afde5b1ad7aa543d18e302a94 (diff)
downloadpuppet-7e45553448f2a051594ee4f2fc83ebcfa4a8114a.tar.gz
puppet-7e45553448f2a051594ee4f2fc83ebcfa4a8114a.tar.xz
puppet-7e45553448f2a051594ee4f2fc83ebcfa4a8114a.zip
Fixed #997 -- virtual defined types are no longer evaluated.
NOTE: This introduces a behaviour change, in that you previously could realize a resource within a virtual defined resource, and now you must realize the entire defined resource, rather than just the contained resource.
Diffstat (limited to 'spec/unit/parser')
-rwxr-xr-xspec/unit/parser/compiler.rb17
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/unit/parser/compiler.rb b/spec/unit/parser/compiler.rb
index d3039996f..6b821977d 100755
--- a/spec/unit/parser/compiler.rb
+++ b/spec/unit/parser/compiler.rb
@@ -169,7 +169,7 @@ describe Puppet::Parser::Compiler, " when compiling" do
end
it "should evaluate unevaluated resources" do
- resource = stub 'notevaluated', :ref => "File[testing]", :builtin? => false, :evaluated? => false
+ resource = stub 'notevaluated', :ref => "File[testing]", :builtin? => false, :evaluated? => false, :virtual? => false
@compiler.add_resource(@scope, resource)
# We have to now mark the resource as evaluated
@@ -179,7 +179,7 @@ describe Puppet::Parser::Compiler, " when compiling" do
end
it "should not evaluate already-evaluated resources" do
- resource = stub 'already_evaluated', :ref => "File[testing]", :builtin? => false, :evaluated? => true
+ resource = stub 'already_evaluated', :ref => "File[testing]", :builtin? => false, :evaluated? => true, :virtual? => false
@compiler.add_resource(@scope, resource)
resource.expects(:evaluate).never
@@ -187,10 +187,10 @@ describe Puppet::Parser::Compiler, " when compiling" do
end
it "should evaluate unevaluated resources created by evaluating other resources" do
- resource = stub 'notevaluated', :ref => "File[testing]", :builtin? => false, :evaluated? => false
+ resource = stub 'notevaluated', :ref => "File[testing]", :builtin? => false, :evaluated? => false, :virtual? => false
@compiler.add_resource(@scope, resource)
- resource2 = stub 'created', :ref => "File[other]", :builtin? => false, :evaluated? => false
+ resource2 = stub 'created', :ref => "File[other]", :builtin? => false, :evaluated? => false, :virtual? => false
# We have to now mark the resource as evaluated
resource.expects(:evaluate).with { |*whatever| resource.stubs(:evaluated?).returns(true); @compiler.add_resource(@scope, resource2) }
@@ -244,6 +244,15 @@ describe Puppet::Parser::Compiler, " when compiling" do
@compiler.add_resource(@scope, resource)
@compiler.findresource("Yay", "foo").should equal(resource)
end
+
+ it "should not evaluate virtual defined resources" do
+ resource = stub 'notevaluated', :ref => "File[testing]", :builtin? => false, :evaluated? => false, :virtual? => true
+ @compiler.add_resource(@scope, resource)
+
+ resource.expects(:evaluate).never
+
+ @compiler.compile
+ end
end
describe Puppet::Parser::Compiler, " when evaluating collections" do