Do not start edit monitor under cog workspace
Edit monitor for cog workspace is not supported, stop the edit monitor
directly if it identifies the cog environment.
Test: atest daemon_manager_test
Bug: 365617369
Change-Id: I0113983b917490bcc0e5a92d6539626b4dbec6d8
diff --git a/tools/edit_monitor/daemon_manager_test.py b/tools/edit_monitor/daemon_manager_test.py
index d62eade..72442c6 100644
--- a/tools/edit_monitor/daemon_manager_test.py
+++ b/tools/edit_monitor/daemon_manager_test.py
@@ -131,6 +131,13 @@
# 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')