summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhishekKr <abhikumar163@gmail.com>2016-06-29 04:11:49 +0530
committerAbhishekKr <abhikumar163@gmail.com>2016-06-29 04:11:49 +0530
commit58e147a9dfa331c359df2c9a2bcc53a27a722ef5 (patch)
tree0502c5ac204d84a063aa10060cc14bc4909a1729
parent5c76329a9fcae1116929cf50c48608d2aa70872c (diff)
downloadchef-58e147a9dfa331c359df2c9a2bcc53a27a722ef5.tar.gz
service - upstart restart - fixing specs and call of stop
-rw-r--r--lib/chef/provider/service/upstart.rb4
-rw-r--r--spec/unit/provider/service/upstart_service_spec.rb6
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb
index 268324b8c7..4acad768a4 100644
--- a/lib/chef/provider/service/upstart.rb
+++ b/lib/chef/provider/service/upstart.rb
@@ -190,9 +190,9 @@ class Chef
# http://upstart.ubuntu.com/cookbook/#restart (it doesn't uses latest jon config from disk but retains old)
else
if @current_resource.running
- stop_command
+ stop_service
sleep 1
- start_command
+ start_service
else
start_service
end
diff --git a/spec/unit/provider/service/upstart_service_spec.rb b/spec/unit/provider/service/upstart_service_spec.rb
index fd9ea0573c..0692bdb64a 100644
--- a/spec/unit/provider/service/upstart_service_spec.rb
+++ b/spec/unit/provider/service/upstart_service_spec.rb
@@ -295,9 +295,11 @@ describe Chef::Provider::Service::Upstart do
@provider.restart_service()
end
- it "should call '/sbin/restart service_name' if no restart command is specified" do
+ it "should call start/sleep/stop if no restart command is specified" do
allow(@current_resource).to receive(:running).and_return(true)
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/sbin/restart #{@new_resource.service_name}").and_return(shell_out_success)
+ expect(@provider).to receive(:stop_service)
+ expect(@provider).to receive(:sleep).with(1)
+ expect(@provider).to receive(:start_service)
@provider.restart_service()
end