summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2009-09-15 21:18:46 +0200
committerJames Turnbull <james@lovedthanlost.net>2009-09-16 11:44:34 +1000
commitd2d7070fb614840db56ca3672548bf5c58a3e4f0 (patch)
treef46ffc5aff86d4b981f2a14766333edd0ac360bb /spec
parentd21b2664abcb13df2967af8caa881e41b19b3b81 (diff)
downloadpuppet-d2d7070fb614840db56ca3672548bf5c58a3e4f0.tar.gz
puppet-d2d7070fb614840db56ca3672548bf5c58a3e4f0.tar.xz
puppet-d2d7070fb614840db56ca3672548bf5c58a3e4f0.zip
Fix #2640 - Daemontools and Runit were not creating the enable symlink
Due to an incorrect tests, those providers weren't enabling themselves when starting, thus failing to create the symlink necessary for them to run. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/provider/service/daemontools.rb21
-rwxr-xr-xspec/unit/provider/service/runit.rb3
2 files changed, 21 insertions, 3 deletions
diff --git a/spec/unit/provider/service/daemontools.rb b/spec/unit/provider/service/daemontools.rb
index 4156afb1f..a2198bb9d 100755
--- a/spec/unit/provider/service/daemontools.rb
+++ b/spec/unit/provider/service/daemontools.rb
@@ -65,7 +65,7 @@ describe provider_class do
describe "when starting" do
it "should use 'svc' to start the service" do
- @provider.stubs(:enabled?).returns true
+ @provider.stubs(:enabled?).returns :true
@provider.expects(:svc).with("-u", "/etc/service/myservice")
@provider.start
@@ -74,7 +74,7 @@ describe provider_class do
it "should enable the service if it is not enabled" do
@provider.stubs(:svc)
- @provider.expects(:enabled?).returns false
+ @provider.expects(:enabled?).returns :false
@provider.expects(:enable)
@provider.start
@@ -124,6 +124,23 @@ describe provider_class do
end
end
+ describe "when checking if the service is enabled?" do
+ it "should return true if it is running" do
+ @provider.stubs(:status).returns(:running)
+
+ @provider.enabled?.should == :true
+ end
+
+ [true, false].each do |t|
+ it "should return #{t} if the symlink exists" do
+ @provider.stubs(:status).returns(:stopped)
+ FileTest.stubs(:symlink?).returns(t)
+
+ @provider.enabled?.should == "#{t}".to_sym
+ end
+ end
+ end
+
describe "when checking status" do
it "should call the external command 'svstat /etc/service/myservice'" do
@provider.expects(:svstat).with(File.join(@servicedir,"myservice"))
diff --git a/spec/unit/provider/service/runit.rb b/spec/unit/provider/service/runit.rb
index 4a7a238a9..ad0ad67f1 100755
--- a/spec/unit/provider/service/runit.rb
+++ b/spec/unit/provider/service/runit.rb
@@ -64,13 +64,14 @@ describe provider_class do
@provider.stubs(:sv)
@provider.stubs(:ucommand)
- @provider.expects(:enabled?).returns false
+ @provider.expects(:enabled?).returns :false
@provider.expects(:enable)
@provider.start
end
it "should execute external command 'sv start /etc/service/myservice'" do
+ @provider.stubs(:enabled?).returns :true
@provider.expects(:ucommand).with(:start).returns("")
@provider.start
end