summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Shafer <andrew@reductivelabs.com>2008-12-08 23:20:43 -0700
committerAndrew Shafer <andrew@reductivelabs.com>2008-12-08 23:20:43 -0700
commite5c36fd865a5699c867e68a23153ec40da919e33 (patch)
tree8486e44fa6dba4ec5d87745bdd64f42db198ec84
parentda71ad53cc49b9a8c56785d865c47bb282e467b6 (diff)
downloadpuppet-e5c36fd865a5699c867e68a23153ec40da919e33.tar.gz
puppet-e5c36fd865a5699c867e68a23153ec40da919e33.tar.xz
puppet-e5c36fd865a5699c867e68a23153ec40da919e33.zip
Fix ZFS autorequire test
Couldn't find a default provider because the world is not my laptop
-rwxr-xr-xspec/unit/type/zfs.rb38
1 files changed, 19 insertions, 19 deletions
diff --git a/spec/unit/type/zfs.rb b/spec/unit/type/zfs.rb
index bce6500b1..08d6e0747 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