Skip to content

Commit 6272076

Browse files
committed
(PUP-10923) Fix launchd provider test
We have helper methods to assert service status, use them.
1 parent e41c8cf commit 6272076

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

acceptance/tests/resource/service/launchd_provider.rb

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,16 @@ def launchctl_assert_status(host, service, expect_running)
8181
end
8282

8383
# switching from stopped to running should output the correct status of the service and not 'absent'
84-
step "Start the service on #{agent} when service is stopped, and check outoput" do
84+
step "Start the service on #{agent} when service is stopped, and check output" do
8585
on agent, puppet_resource('service', svc, 'ensure=stopped')
86-
on agent, puppet_resource('service', svc, 'ensure=running') do |result|
87-
assert_match(/service { '#{svc}':\n ensure.+=> 'running',\n}$/, stdout, 'Service status change failed')
88-
end
86+
on agent, puppet_resource('service', svc, 'ensure=running')
87+
assert_service_status_on_host(agent, svc, {:ensure => 'running'})
8988
end
9089

91-
# switching from running to stopped should output the correct status of the service and not 'absent'
92-
step "Start the service on #{agent} when service is running, and check outoput" do
90+
# switching from running to stopped should output the correct status of the service and not 'absent'
91+
step "Stop the service on #{agent} when service is running, and check output" do
9392
on agent, puppet_resource('service', svc, 'ensure=running')
94-
on agent, puppet_resource('service', svc, 'ensure=stopped') do |result|
95-
assert_match(/service { '#{svc}':\n ensure.+=> 'stopped',\n}$/, stdout, 'Service status change failed')
96-
end
93+
on agent, puppet_resource('service', svc, 'ensure=stopped')
94+
assert_service_status_on_host(agent, svc, {:ensure => 'stopped'})
9795
end
98-
9996
end

0 commit comments

Comments
 (0)