Loading tools/edit_monitor/daemon_manager.py +4 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,10 @@ class DaemonManager: logging.warning("Block sign found, exiting...") return if self.binary_path.startswith('/google/cog/'): logging.warning("Edit monitor for cog is not supported, exiting...") return self._stop_any_existing_instance() self._write_pid_to_pidfile() self._start_daemon_process() Loading tools/edit_monitor/daemon_manager_test.py +7 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,13 @@ class DaemonManagerTest(unittest.TestCase): # Verify no daemon process is started. self.assertIsNone(dm.daemon_process) def test_start_return_directly_if_in_cog_env(self): dm = daemon_manager.DaemonManager( '/google/cog/cloud/user/workspace/edit_monitor') dm.start() # Verify no daemon process is started. self.assertIsNone(dm.daemon_process) @mock.patch('os.kill') def test_start_failed_to_kill_existing_instance(self, mock_kill): mock_kill.side_effect = OSError('Unknown OSError') Loading Loading
tools/edit_monitor/daemon_manager.py +4 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,10 @@ class DaemonManager: logging.warning("Block sign found, exiting...") return if self.binary_path.startswith('/google/cog/'): logging.warning("Edit monitor for cog is not supported, exiting...") return self._stop_any_existing_instance() self._write_pid_to_pidfile() self._start_daemon_process() Loading
tools/edit_monitor/daemon_manager_test.py +7 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,13 @@ class DaemonManagerTest(unittest.TestCase): # Verify no daemon process is started. self.assertIsNone(dm.daemon_process) def test_start_return_directly_if_in_cog_env(self): dm = daemon_manager.DaemonManager( '/google/cog/cloud/user/workspace/edit_monitor') dm.start() # Verify no daemon process is started. self.assertIsNone(dm.daemon_process) @mock.patch('os.kill') def test_start_failed_to_kill_existing_instance(self, mock_kill): mock_kill.side_effect = OSError('Unknown OSError') Loading