summaryrefslogtreecommitdiffstats
path: root/spec/integration
diff options
context:
space:
mode:
authorPieter van de Bruggen <pieter@puppetlabs.com>2011-04-18 13:40:31 -0700
committerPieter van de Bruggen <pieter@puppetlabs.com>2011-04-18 14:08:32 -0700
commit07b677c5f6af8def03c5c30393fd83bc3986239a (patch)
treeb28d3376b4ea835a2348ebfea898d674cb593e34 /spec/integration
parentb142973a94ced6c0ff43da882189abe806c18c68 (diff)
Merge remote-tracking branch 'community/feature/puppet-device' into 2.7.x
Reviewed-By: Mike Stahnke
Diffstat (limited to 'spec/integration')
-rwxr-xr-xspec/integration/transaction_spec.rb56
1 files changed, 56 insertions, 0 deletions
diff --git a/spec/integration/transaction_spec.rb b/spec/integration/transaction_spec.rb
index 41a1ebac3..78d62fc51 100755
--- a/spec/integration/transaction_spec.rb
+++ b/spec/integration/transaction_spec.rb
@@ -75,6 +75,62 @@ describe Puppet::Transaction do
transaction.evaluate
end
+ it "should not apply device resources on normal host" do
+ catalog = Puppet::Resource::Catalog.new
+ resource = Puppet::Type.type(:interface).new :name => "FastEthernet 0/1"
+ catalog.add_resource resource
+
+ transaction = Puppet::Transaction.new(catalog)
+ transaction.for_network_device = false
+
+ transaction.expects(:apply).never.with(resource, nil)
+
+ transaction.evaluate
+ transaction.resource_status(resource).should be_skipped
+ end
+
+ it "should not apply host resources on device" do
+ catalog = Puppet::Resource::Catalog.new
+ resource = Puppet::Type.type(:file).new :path => "/foo/bar", :backup => false
+ catalog.add_resource resource
+
+ transaction = Puppet::Transaction.new(catalog)
+ transaction.for_network_device = true
+
+ transaction.expects(:apply).never.with(resource, nil)
+
+ transaction.evaluate
+ transaction.resource_status(resource).should be_skipped
+ end
+
+ it "should apply device resources on device" do
+ catalog = Puppet::Resource::Catalog.new
+ resource = Puppet::Type.type(:interface).new :name => "FastEthernet 0/1"
+ catalog.add_resource resource
+
+ transaction = Puppet::Transaction.new(catalog)
+ transaction.for_network_device = true
+
+ transaction.expects(:apply).with(resource, nil)
+
+ transaction.evaluate
+ transaction.resource_status(resource).should_not be_skipped
+ end
+
+ it "should apply resources appliable on host and device on a device" do
+ catalog = Puppet::Resource::Catalog.new
+ resource = Puppet::Type.type(:schedule).new :name => "test"
+ catalog.add_resource resource
+
+ transaction = Puppet::Transaction.new(catalog)
+ transaction.for_network_device = true
+
+ transaction.expects(:apply).with(resource, nil)
+
+ transaction.evaluate
+ transaction.resource_status(resource).should_not be_skipped
+ end
+
# Verify that one component requiring another causes the contained
# resources in the requiring component to get refreshed.
it "should propagate events from a contained resource through its container to its dependent container's contained resources" do