def test_resumes_a_stopped_upstart_service(self, service, check_output,
systemd, service_running):
"""When the service is stopped, service start is called."""
check_output.return_value = b'foo-service stop/waiting'
service_name = 'foo-service'
service.side_effect = [True]
systemd.return_value = False
service_running.return_value = False
tempdir = mkdtemp(prefix="test_resumes_an_upstart_service")
conf_path = os.path.join(tempdir, "{}.conf".format(service_name))
with open(conf_path, "w") as fh:
fh.write("")
self.addCleanup(rmtree, tempdir)
self.assertTrue(host.service_resume(service_name, init_dir=tempdir))
service.assert_called_with('start', service_name)
override_path = os.path.join(
tempdir, "{}.override".format(service_name))
self.assertFalse(os.path.exists(override_path))
评论列表
文章目录