[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

Andrew Shafer andrew at reductivelabs.com
Fri Jan 23 14:21:58 UTC 2009


The following commit has been merged in the master branch:
commit e5c36fd865a5699c867e68a23153ec40da919e33
Author: Andrew Shafer <andrew at reductivelabs.com>
Date:   Mon Dec 8 23:20:43 2008 -0700

    Fix ZFS autorequire test
    
    Couldn't find a default provider because the world is not my laptop

diff --git a/spec/unit/type/zfs.rb b/spec/unit/type/zfs.rb
index bce6500..08d6e07 100755
--- a/spec/unit/type/zfs.rb
+++ b/spec/unit/type/zfs.rb
@@ -2,19 +2,14 @@
 
 Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }
 
-zpool = Puppet::Type.type(:zfs)
-
-describe zpool do
-    before do
-        @provider = stub 'provider'
-        @resource = stub 'resource', :resource => nil, :provider => @provider, :line => nil, :file => nil
-    end
+zfs = Puppet::Type.type(:zfs)
 
+describe zfs do
     properties = [:ensure, :mountpoint, :compression, :copies, :quota, :reservation, :sharenfs, :snapdir]
 
     properties.each do |property|
         it "should have a %s property" % property do
-            zpool.attrclass(property).ancestors.should be_include(Puppet::Property)
+            zfs.attrclass(property).ancestors.should be_include(Puppet::Property)
         end
     end
 
@@ -22,24 +17,29 @@ describe zpool do
 
     parameters.each do |parameter|
         it "should have a %s parameter" % parameter do
-            zpool.attrclass(parameter).ancestors.should be_include(Puppet::Parameter)
+            zfs.attrclass(parameter).ancestors.should be_include(Puppet::Parameter)
         end
     end
 
     it "should autorequire the containing zfss and the zpool" do
-            #this is a little funky because the autorequire depends on a property with a feature
-            foo_pool = Puppet.type(:zpool).create(:name => "foo")
+        provider = mock "provider"
+        provider.stubs(:name).returns(:solaris)
+        zfs.stubs(:defaultprovider).returns(provider)
+        Puppet.type(:zpool).stubs(:defaultprovider).returns(provider)
+
 
-            foo_bar_zfs = Puppet.type(:zfs).create(:name => "foo/bar")
-            foo_bar_baz_zfs = Puppet.type(:zfs).create(:name => "foo/bar/baz")
-            foo_bar_baz_buz_zfs = Puppet.type(:zfs).create(:name => "foo/bar/baz/buz")
+        foo_pool = Puppet.type(:zpool).create(:name => "foo")
 
-            config = Puppet::Node::Catalog.new :testing do |conf|
-                [foo_pool, foo_bar_zfs, foo_bar_baz_zfs, foo_bar_baz_buz_zfs].each { |resource| conf.add_resource resource }
-            end
+        foo_bar_zfs = Puppet.type(:zfs).create(:name => "foo/bar")
+        foo_bar_baz_zfs = Puppet.type(:zfs).create(:name => "foo/bar/baz")
+        foo_bar_baz_buz_zfs = Puppet.type(:zfs).create(:name => "foo/bar/baz/buz")
+
+        config = Puppet::Node::Catalog.new :testing do |conf|
+            [foo_pool, foo_bar_zfs, foo_bar_baz_zfs, foo_bar_baz_buz_zfs].each { |resource| conf.add_resource resource }
+        end
 
-            req = foo_bar_baz_buz_zfs.autorequire.collect { |edge| edge.source.ref }
+        req = foo_bar_baz_buz_zfs.autorequire.collect { |edge| edge.source.ref }
 
-            [foo_pool.ref, foo_bar_zfs.ref, foo_bar_baz_zfs.ref].each { |ref| req.include?(ref).should == true }
+        [foo_pool.ref, foo_bar_zfs.ref, foo_bar_baz_zfs.ref].each { |ref| req.include?(ref).should == true }
     end
 end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list