def test_start_service_exits_when_already_running(
self, mock_bootstrap_list, mock_reactor):
self.log_helper.ignore_errors(
"ERROR: The following daemons are already running: program-name")
service = WatchDogService(self.configuration)
service.watchdog = mock.Mock()
service.watchdog.check_running.return_value = succeed([StubDaemon()])
result = service.startService()
self.assertEqual(service.exit_code, 1)
mock_bootstrap_list.bootstrap.assert_called_once_with(
data_path=self.data_path, log_dir=self.log_dir)
service.watchdog.check_running.assert_called_once_with()
self.assertTrue(mock_reactor.crash.called)
return result
评论列表
文章目录