summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorDominic Cleal <dcleal@redhat.com>2011-02-19 19:00:36 +0000
committerDominic Cleal <dcleal@redhat.com>2011-02-19 19:02:30 +0000
commit7639d5f2de43a117796e91e36f6ac63c4ff05591 (patch)
treee2fee6f46edb45ddc186a354681a394480f6da10 /spec
parentf5e21f0796038f8635af0f826eab9d62b494ba49 (diff)
Fix non-existent method called in SMF manifest import exception message, updated spec
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/provider/service/smf_spec.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/spec/unit/provider/service/smf_spec.rb b/spec/unit/provider/service/smf_spec.rb
index 2f7ecc4aa..40e96ab23 100755
--- a/spec/unit/provider/service/smf_spec.rb
+++ b/spec/unit/provider/service/smf_spec.rb
@@ -99,14 +99,25 @@ describe provider_class do
@provider.expects(:texecute).with(:start, ["/usr/sbin/svcadm", :clear, "/system/myservice"], true)
@provider.start
end
+ end
- it "should import the manifest if service is not found" do
- @resource[:manifest] = "/tmp/myservice.xml"
+ describe "when starting a service with a manifest" do
+ before(:each) do
+ @resource = Puppet::Type.type(:service).new(:name => "/system/myservice", :ensure => :running, :enable => :true, :manifest => "/tmp/myservice.xml")
+ @provider = provider_class.new(@resource)
$CHILD_STATUS.stubs(:exitstatus).returns(1)
+ end
+
+ it "should import the manifest if service is missing" do
@provider.expects(:svccfg).with(:import, "/tmp/myservice.xml")
@provider.expects(:texecute).with(:start, ["/usr/sbin/svcadm", :enable, "/system/myservice"], true)
@provider.start
end
+
+ it "should handle failures if importing a manifest" do
+ @provider.expects(:svccfg).raises(Puppet::ExecutionFailure.new("can't svccfg import"))
+ lambda { @provider.start }.should raise_error(Puppet::Error, "Cannot config /system/myservice to enable it: can't svccfg import")
+ end
end
describe "when stopping" do