From bbf01bc89a21f444d550a1510c53db1ef20c64ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Goinvic?= Date: Fri, 25 Jul 2025 15:38:28 +0200 Subject: [PATCH 1/2] fix flaking upgrade test --- tests/integration/test_networking.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/integration/test_networking.py b/tests/integration/test_networking.py index e8ea68f9..429ee6c6 100644 --- a/tests/integration/test_networking.py +++ b/tests/integration/test_networking.py @@ -173,10 +173,9 @@ async def test_pods_monitored( @pytest.mark.skipif( os.environ.get("SKIP_SERVICE_MONITORS_CRDS", "false") == "true", reason="ServiceMonitors not deployed" ) -@pytest.mark.skipif(os.environ.get("MATRIX_TEST_FROM_REF", "") == "25.6.2", reason="This fails against 25.6.2.") @pytest.mark.asyncio_cooperative -@pytest.mark.usefixtures("matrix_stack") async def test_service_monitors_point_to_metrics( + matrix_stack, kube_client: AsyncClient, generated_data: ESSData, ): From 2d119d797193b0f13f7cd5fa50641c4cfc9b4db0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Goinvic?= Date: Fri, 25 Jul 2025 15:39:24 +0200 Subject: [PATCH 2/2] upgrade: fix flaky tests --- newsfragments/627.internal.md | 1 + tests/integration/test_networking.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 newsfragments/627.internal.md diff --git a/newsfragments/627.internal.md b/newsfragments/627.internal.md new file mode 100644 index 00000000..14068f19 --- /dev/null +++ b/newsfragments/627.internal.md @@ -0,0 +1 @@ +Fix flaking tests when checking upgrades. diff --git a/tests/integration/test_networking.py b/tests/integration/test_networking.py index 429ee6c6..d2bf055a 100644 --- a/tests/integration/test_networking.py +++ b/tests/integration/test_networking.py @@ -40,7 +40,7 @@ async def test_services_have_matching_labels( label_selectors = {label: value for label, value in service.spec.selector.items()} async for pod in kube_client.list(Pod, namespace=generated_data.ess_namespace, labels=label_selectors): - if pod.status and pod.status.phase not in ("Terminating", "Succeeded"): + if pod.status and pod.status.phase in ("Terminating", "Succeeded"): continue # Skip terminating pods assert service.metadata, f"Encountered a service without metadata : {service}" assert pod.metadata, f"Encountered a pod without metadata : {pod}" @@ -173,9 +173,10 @@ async def test_pods_monitored( @pytest.mark.skipif( os.environ.get("SKIP_SERVICE_MONITORS_CRDS", "false") == "true", reason="ServiceMonitors not deployed" ) +@pytest.mark.skipif(os.environ.get("MATRIX_TEST_FROM_REF", "") == "25.6.2", reason="This fails against 25.6.2.") @pytest.mark.asyncio_cooperative +@pytest.mark.usefixtures("matrix_stack") async def test_service_monitors_point_to_metrics( - matrix_stack, kube_client: AsyncClient, generated_data: ESSData, ):