From 2b1f4fbd5847115c6edfb884be9edf5f9dc3bb1e Mon Sep 17 00:00:00 2001 From: thomas hague Date: Mon, 20 Jul 2026 13:35:54 +0100 Subject: [PATCH 1/2] [RAA-9310]-[GC]-[re-trigger pipelines]-[TH] From 9c302fa29565e2c0ad4e1ec434bd939d6b087f4c Mon Sep 17 00:00:00 2001 From: thomas hague Date: Tue, 21 Jul 2026 11:12:43 +0100 Subject: [PATCH 2/2] [RAA-9996]-[GC]-[Adjust smoke test for APIM lower-env monitoring change]-[TH] --- tests/smoke/test_status_endpoints.py | 59 ++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/tests/smoke/test_status_endpoints.py b/tests/smoke/test_status_endpoints.py index 2605aa113..87ea0b42e 100644 --- a/tests/smoke/test_status_endpoints.py +++ b/tests/smoke/test_status_endpoints.py @@ -3,6 +3,9 @@ import requests from jsonpath_rw import parse +# test runs normally in int and prod, status must report pass +STRICT_STATUS_ENVS = {"int", "prod"} + @pytest.mark.smoke_test class TestStatusEndpoints: @@ -14,25 +17,49 @@ def test_ping_endpoint(self, service_url): f"Actual response status code = {response.status_code}" ) - def test_status_endpoint(self, service_url, status_endpoint_api_key): + def test_status_endpoint(self, service_url, status_endpoint_api_key, environment): response = requests.get( f"{service_url}/_status", headers={"apikey": status_endpoint_api_key} ) - with check: - assert response.status_code == 200, ( - f"UNEXPECTED RESPONSE: " - f"Actual response status code = {response.status_code}" + assert response.status_code == 200, ( + f"UNEXPECTED RESPONSE: " + f"Actual response status code = {response.status_code}" + ) + + # parse JSON response and extract the value + response_json = response.json() + top_level_statuses = [ + match.value for match in parse("$.status").find(response_json) + ] + healthcheck_statuses = [ + match.value + for match in parse('$.checks["healthcheckService:status"][*].status').find( + response_json ) - with check: - expression = parse("$.status") - matches = [match.value for match in expression.find(response.json())] - assert matches.count("pass") == 1, ( - f"UNEXPECTED RESPONSE: " f"Health check failed: $.status != 'pass'" + ] + + # normal test behaviour in int and prod + if environment in STRICT_STATUS_ENVS: + assert ( + top_level_statuses.count("pass") == 1 + ), "UNEXPECTED RESPONSE: Health check failed: $.status != 'pass'" + assert healthcheck_statuses.count("pass") == len(healthcheck_statuses), ( + "UNEXPECTED RESPONSE: Health check failed: " + "$.checks['healthcheckService:status'][*].status != 'pass'" ) - with check: - expression = parse('$.checks["healthcheckService:status"][*].status') - matches = [match.value for match in expression.find(response.json())] - assert matches.count("pass") == len(matches), ( - f"UNEXPECTED RESPONSE: " - f"Health check failed: $.checks['healthcheckService:status'][*].status)] != 'pass'" + return + + # Monitoring in lower environments is intentionally disabled, so making the test less strict. + assert len(top_level_statuses) == 1 and top_level_statuses[0] in { + "pass", + "fail", + }, "UNEXPECTED RESPONSE: $.status missing or invalid" + assert len(healthcheck_statuses) >= 1 and all( + status in {"pass", "fail"} for status in healthcheck_statuses + ), "UNEXPECTED RESPONSE: healthcheckService status missing or invalid" + + # mark failures as expected behaviour + if top_level_statuses[0] == "fail": + pytest.xfail( + "Known APIM lower-env behavior: _status may report fail outside int/prod" )