diff --git a/siso.py b/siso.py index 344427c25d..6075c0d185 100644 --- a/siso.py +++ b/siso.py @@ -137,10 +137,9 @@ def _start_collector(siso_path: str, sockets_file: Optional[str], class Status(Enum): HEALTHY = 1 - WRONG_PROJECT = 2 - WRONG_ENDPOINT = 3 - UNHEALTHY = 4 - DEAD = 5 + WRONG_ENDPOINT = 2 + UNHEALTHY = 3 + DEAD = 4 def collector_status() -> Status: conn = http.client.HTTPConnection(f"localhost:{_OTLP_HEALTH_PORT}") @@ -156,8 +155,6 @@ def _start_collector(siso_path: str, sockets_file: Optional[str], status = json.loads(response.read()) if not status["healthy"] or status["status"] != "StatusOK": return Status.UNHEALTHY - if fetch_project(conn) != project: - return Status.WRONG_PROJECT endpoint = fetch_receiver_endpoint(conn) expected_endpoint = sockets_file or _OTLP_DEFAULT_TCP_ENDPOINT @@ -166,15 +163,6 @@ def _start_collector(siso_path: str, sockets_file: Optional[str], return Status.HEALTHY - def fetch_project(conn: http.client.HTTPConnection) -> str: - conn.request("GET", "/health/config") - response = conn.getresponse() - resp_json = json.loads(response.read()) - try: - return resp_json["exporters"]["googlecloud"]["project"] - except KeyError: - return "" - def fetch_receiver_endpoint(conn: http.client.HTTPConnection) -> str: conn.request("GET", "/health/config") response = conn.getresponse() diff --git a/tests/siso_test.py b/tests/siso_test.py index c13f424721..d601e95fa4 100755 --- a/tests/siso_test.py +++ b/tests/siso_test.py @@ -815,7 +815,7 @@ ninja --failure_verbose=false -k=0 @mock.patch('siso.platform.system', return_value='Linux') @mock.patch('siso.json.loads') - def test_start_collector_wrong_project_then_healthy(self, mock_json_loads, + def test_start_collector_wrong_project_no_restart(self, mock_json_loads, _mock_system): m = self._start_collector_mocks() siso_path = "siso_path" @@ -824,7 +824,6 @@ ninja --failure_verbose=false -k=0 status_responses=[(200, None), (200, None)], config_responses=[(200, None), - (200, None), (200, None)]) status_healthy = {'healthy': True, 'status': 'StatusOK'} @@ -844,37 +843,15 @@ ninja --failure_verbose=false -k=0 } } } - config_project_full = { - 'exporters': { - 'googlecloud': { - 'project': project - } - }, - 'receivers': { - 'otlp': { - 'protocols': { - 'grpc': { - 'endpoint': siso._OTLP_DEFAULT_TCP_ENDPOINT - } - } - } - } - } mock_json_loads.side_effect = [ - status_healthy, config_wrong_project_full, status_healthy, - config_project_full, config_project_full + status_healthy, config_wrong_project_full ] result = siso._start_collector(siso_path, None, project) self.assertTrue(result) - m.subprocess_popen.assert_called_once_with( - [siso_path, "collector", "--project", project], - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, - start_new_session=True, - creationflags=0) - m.kill_collector.assert_called_once() + m.subprocess_popen.assert_not_called() + m.kill_collector.assert_not_called() @mock.patch('siso.json.loads') def test_start_collector_already_healthy(self, mock_json_loads):