summaryrefslogtreecommitdiff
path: root/spec/unit/provider/service
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/provider/service')
-rw-r--r--spec/unit/provider/service/upstart_service_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/unit/provider/service/upstart_service_spec.rb b/spec/unit/provider/service/upstart_service_spec.rb
index 1c8e304cb7..6fb1f9fdbf 100644
--- a/spec/unit/provider/service/upstart_service_spec.rb
+++ b/spec/unit/provider/service/upstart_service_spec.rb
@@ -123,6 +123,25 @@ describe Chef::Provider::Service::Upstart do
end
end
+ describe "when the status command uses the new format with an instance" do
+ before do
+ end
+
+ it "should set running to true if the status command returns 0" do
+ @stdout = StringIO.new("rsyslog (test) start/running, process 100")
+ allow(@provider).to receive(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status)
+ @provider.load_current_resource
+ expect(@current_resource.running).to be_truthy
+ end
+
+ it "should set running to false if the status command returns anything except 0" do
+ @stdout = StringIO.new("rsyslog (test) stop/waiting, process 100")
+ allow(@provider).to receive(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status)
+ @provider.load_current_resource
+ expect(@current_resource.running).to be_falsey
+ end
+ end
+
describe "when the status command uses the old format" do
it "should set running to true if the status command returns 0" do
@stdout = StringIO.new("rsyslog (start) running, process 32225")