From 1262946a3ea3bbf4072820a8c6362d7e78ab43fe Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Wed, 18 Feb 2026 17:26:24 -0500 Subject: [PATCH] Refine Kubernetes E2E polling logic to check backend readiness beyond HTTP 503 - Updated polling step to consider non-503 responses (e.g., 200/401/403) as backend readiness. - Improved logging to reflect updated readiness criteria. - Enhanced robustness by distinguishing between transient and configured backend states. --- tests_e2e/test_kubernetes.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests_e2e/test_kubernetes.py b/tests_e2e/test_kubernetes.py index 7eb95fb..9a6e05b 100644 --- a/tests_e2e/test_kubernetes.py +++ b/tests_e2e/test_kubernetes.py @@ -860,8 +860,10 @@ def wait_for_easyhaproxy_discovery(kubectl_cmd: str, expected_host: str, timeout time.sleep(1) - # Step 4: Poll until the backend returns 200 (not just any response) - print(f" → Waiting for backend to return 200...") + # Step 4: Poll until HAProxy returns a real response (not 503/000). + # 503 means the backend is not ready yet; 200/401/403/etc. all mean the + # backend is up and HAProxy has fully configured the route. + print(f" → Waiting for backend to become ready (non-503)...") while time.time() - start_time < timeout: try: result = subprocess.run( @@ -872,10 +874,10 @@ def wait_for_easyhaproxy_discovery(kubectl_cmd: str, expected_host: str, timeout timeout=5 ) http_code = result.stdout.strip() - if http_code == "200": - print(f" ✓ Backend is ready (HTTP 200)") + if http_code and http_code not in ("000", "503"): + print(f" ✓ Backend is ready (HTTP {http_code})") return True - if http_code and http_code != "000": + if http_code: print(f" … Backend not ready yet (HTTP {http_code}), retrying...") except Exception: pass