From 82561875ec1da90c770044f414f07ca1d4be067d Mon Sep 17 00:00:00 2001 From: Jamo Luhrsen Date: Thu, 26 Feb 2026 09:34:49 -0800 Subject: [PATCH] test: log HTTP response body to debug 403 errors in idle test The router idling test is failing with HTTP 403 Forbidden on metal-ipi-ovn-dualstack-bgp jobs starting Feb 20, 2026. Root cause is still unknown. This commit adds diagnostic logging to capture the actual HTTP response body and headers for the first 10 failed requests. Changes: - Log full HTTP headers on non-200 responses (first 10 attempts) - Log response body preview (up to 500 chars) - After attempt 10, just log status code to avoid log spam This will help identify: - What component is returning 403 (HAProxy, proxy, auth service) - Why it's forbidden (error message in response body) - Any relevant headers (forwarding, auth, server info) Affects: e2e-metal-ipi-ovn-dualstack-bgp Related: Investigation of Feb 20, 2026 test failures --- test/extended/router/idle.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/test/extended/router/idle.go b/test/extended/router/idle.go index 7669075d9e7f..f601a7d86b11 100644 --- a/test/extended/router/idle.go +++ b/test/extended/router/idle.go @@ -311,8 +311,24 @@ func waitHTTPGetStatus(hostname string, statusCode int, timeout time.Duration) e return false, nil // could be 503 if service not ready } defer resp.Body.Close() - io.Copy(ioutil.Discard, resp.Body) - e2e.Logf("GET#%v %q status=%v", attempt, url, resp.StatusCode) + + // Read response body to help debug unexpected status codes + bodyBytes, readErr := ioutil.ReadAll(resp.Body) + if readErr != nil { + e2e.Logf("GET#%v %q status=%v (failed to read body: %v)", attempt, url, resp.StatusCode, readErr) + } else { + // Log full details on unexpected status codes (first 10 attempts) + if resp.StatusCode != statusCode && attempt <= 10 { + bodyPreview := string(bodyBytes) + if len(bodyPreview) > 500 { + bodyPreview = bodyPreview[:500] + "..." + } + e2e.Logf("GET#%v %q status=%v headers=%v body=%q", + attempt, url, resp.StatusCode, resp.Header, bodyPreview) + } else { + e2e.Logf("GET#%v %q status=%v", attempt, url, resp.StatusCode) + } + } return resp.StatusCode == statusCode, nil }) }