diff options
author | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-09-15 21:18:46 +0200 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-09-16 11:44:34 +1000 |
commit | d2d7070fb614840db56ca3672548bf5c58a3e4f0 (patch) | |
tree | f46ffc5aff86d4b981f2a14766333edd0ac360bb /spec | |
parent | d21b2664abcb13df2967af8caa881e41b19b3b81 (diff) | |
download | puppet-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-x | spec/unit/provider/service/daemontools.rb | 21 | ||||
-rwxr-xr-x | spec/unit/provider/service/runit.rb | 3 |
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 |