summaryrefslogtreecommitdiffstats
path: root/spec/unit/node
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-11-05 21:44:42 -0600
committerLuke Kanies <luke@madstop.com>2008-11-05 21:44:42 -0600
commit35c623e65b44fed098374288e8c1dfc450a1f9f7 (patch)
tree0d000c4b3b48904e95142ce3a6f39b44d1e67143 /spec/unit/node
parentf4800e8aeb6196aebc43d36f69b2e2a182d1bf5c (diff)
downloadpuppet-35c623e65b44fed098374288e8c1dfc450a1f9f7.tar.gz
puppet-35c623e65b44fed098374288e8c1dfc450a1f9f7.tar.xz
puppet-35c623e65b44fed098374288e8c1dfc450a1f9f7.zip
Removing mid-transaction resources from the catalog.
This basically just cleans up dynamic resources. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/node')
-rwxr-xr-xspec/unit/node/catalog.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/node/catalog.rb b/spec/unit/node/catalog.rb
index c986fc24e..68b8af347 100755
--- a/spec/unit/node/catalog.rb
+++ b/spec/unit/node/catalog.rb
@@ -784,6 +784,20 @@ describe Puppet::Node::Catalog, " when creating a relationship graph" do
@catalog.resource("File[/yay]").should be_nil
end
+ it "should remove resources added mid-transaction" do
+ @transaction = mock 'transaction'
+ Puppet::Transaction.stubs(:new).returns(@transaction)
+ @transaction.stubs(:evaluate)
+ @transaction.stubs(:cleanup)
+ @transaction.stubs(:addtimes)
+ file = Puppet::Type.type(:file).create(:name => "/yay", :ensure => :file)
+ @catalog.apply do |trans|
+ @catalog.add_resource file
+ @catalog.resource("File[/yay]").should_not be_nil
+ end
+ @catalog.resource("File[/yay]").should be_nil
+ end
+
it "should remove resources from the relationship graph if it exists" do
@catalog.remove_resource(@one)
@catalog.relationship_graph.vertex?(@one).should be_false