This adds a test at the catalog level to ensure that we generate the right
graph relationships; this indirectly tests that the underlying code does the
right thing, but importantly also makes us fairly immune to low level changes.

Reviewed-By: Daniel Pittman <[email protected]>
Reviewed-By: Matt Robinson <[email protected]>
---
 spec/unit/type/zone_spec.rb |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/spec/unit/type/zone_spec.rb b/spec/unit/type/zone_spec.rb
index 726ccc2..a3e748b 100755
--- a/spec/unit/type/zone_spec.rb
+++ b/spec/unit/type/zone_spec.rb
@@ -57,4 +57,24 @@ describe zone do
     zone.new(:name => "dummy", :path => "/dummy", :ip => "if", :iptype => 
:exclusive)
   end
 
+  it "should auto-require :dataset entries" do
+    fs = 'random-pool/some-zfs'
+
+    # ick
+    provider = stub 'zfs::provider'
+    provider.stubs(:name).returns(:solaris)
+    Puppet::Type.type(:zfs).stubs(:defaultprovider).returns(provider)
+
+    catalog = Puppet::Resource::Catalog.new
+    zfs_instance = Puppet::Type.type(:zfs).new(:name => fs)
+    catalog.add_resource zfs_instance
+
+    zone_instance = zone.new(:name    => "dummy",
+                             :path    => "/foo",
+                             :ip      => 'en1:1.0.0.0',
+                             :dataset => fs)
+    catalog.add_resource zone_instance
+
+    catalog.relationship_graph.dependencies(zone_instance).should == 
[zfs_instance]
+  end
 end
-- 
1.7.4.1

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to