summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorAndrew Shafer <andrew@reductivelabs.com>2008-12-01 02:58:09 -0700
committerJames Turnbull <james@lovedthanlost.net>2008-12-01 21:00:27 +1100
commit3eff2254e69cf66b6e9f94631900fba26172c850 (patch)
treef7a994f9f3d9f7338993e7aa3bf01da09bebcd2d /spec/unit
parentfa9820baaebe29675defb14bc9d64f6cb9b75211 (diff)
downloadpuppet-3eff2254e69cf66b6e9f94631900fba26172c850.tar.gz
puppet-3eff2254e69cf66b6e9f94631900fba26172c850.tar.xz
puppet-3eff2254e69cf66b6e9f94631900fba26172c850.zip
Feature 1696 Add support for branded zones
Applied the patch from the ticket and wrote tests with the changes
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/provider/zone/solaris.rb42
-rwxr-xr-xspec/unit/type/zone.rb20
2 files changed, 62 insertions, 0 deletions
diff --git a/spec/unit/provider/zone/solaris.rb b/spec/unit/provider/zone/solaris.rb
new file mode 100755
index 000000000..b7dd74705
--- /dev/null
+++ b/spec/unit/provider/zone/solaris.rb
@@ -0,0 +1,42 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../../spec_helper'
+
+provider_class = Puppet::Type.type(:zone).provider(:solaris)
+
+describe provider_class do
+ before do
+ @resource = stub("resource", :name => "mypool")
+ @resource.stubs(:[]).returns "shouldvalue"
+ @provider = provider_class.new(@resource)
+ end
+
+ describe "when calling configure" do
+ it "should add the create args to the create str" do
+ @resource.stubs(:properties).returns([])
+ @resource.stubs(:[]).with(:create_args).returns("create_args")
+ @provider.expects(:setconfig).with("create -b create_args\nset zonepath=shouldvalue\ncommit\n")
+ @provider.configure
+ end
+ end
+
+ describe "when installing" do
+ it "should call zoneadm" do
+ @provider.expects(:zoneadm)
+ @provider.install
+ end
+
+ it "should just install if there are no install args" do
+ @resource.stubs(:[]).with(:install_args).returns(nil)
+ @provider.expects(:zoneadm).with(:install)
+ @provider.install
+ end
+
+ it "should add the install args to the command if they exist" do
+ @resource.stubs(:[]).with(:install_args).returns("install args")
+ @provider.expects(:zoneadm).with(:install, ["install", "args"])
+ @provider.install
+ end
+ end
+
+end
diff --git a/spec/unit/type/zone.rb b/spec/unit/type/zone.rb
new file mode 100755
index 000000000..c99302644
--- /dev/null
+++ b/spec/unit/type/zone.rb
@@ -0,0 +1,20 @@
+#!/usr/bin/env ruby
+
+Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }
+
+zone = Puppet::Type.type(:zone)
+
+describe zone do
+ before do
+ @provider = stub 'provider'
+ @resource = stub 'resource', :resource => nil, :provider => @provider, :line => nil, :file => nil
+ end
+
+ parameters = [:create_args, :install_args]
+
+ parameters.each do |parameter|
+ it "should have a %s parameter" % parameter do
+ zone.attrclass(parameter).ancestors.should be_include(Puppet::Parameter)
+ end
+ end
+end