From eb0ada9eb6ed722dc59adf921cb63760670f44e1 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 23:20:11 +0000 Subject: [PATCH] test(e2e): retry security override calls on a 409 conflict The operator writes GameServer status after each update, so the resourceVersion read for the next PUT can go stale and the API answers 409 "conflict, retry". Repeat the call with a fresh body on 409 (up to 5 tries), as a real client does; every final status check is unchanged. Fixes the red e2e operator / arm64 job on master 55e2c609. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Claude --- test/e2e/api_security_override_e2e_test.go | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/test/e2e/api_security_override_e2e_test.go b/test/e2e/api_security_override_e2e_test.go index 99487b2d5..f20e83138 100644 --- a/test/e2e/api_security_override_e2e_test.go +++ b/test/e2e/api_security_override_e2e_test.go @@ -128,14 +128,26 @@ func TestAPI_SecurityOverride_PermissionAndRootRule(t *testing.T) { }) // expect runs one API call, closes its response, checks the status and - // returns the body. + // returns the body. A 409 "conflict, retry" means the GameServer's + // resourceVersion moved between reading it and the PUT (the operator + // writes status after each update), so the call is repeated with a fresh + // body, as a real client would. Any other status is checked at once. expect := func(what string, want int, do func() (*http.Response, []byte, error)) []byte { t.Helper() - r, b, err := do() - if err != nil { - t.Fatalf("%s: %v", what, err) + var r *http.Response + var b []byte + var err error + for attempt := 0; attempt < 5; attempt++ { + r, b, err = do() + if err != nil { + t.Fatalf("%s: %v", what, err) + } + _ = r.Body.Close() + if r.StatusCode != http.StatusConflict || want == http.StatusConflict { + break + } + time.Sleep(time.Second) } - _ = r.Body.Close() if r.StatusCode != want { t.Fatalf("%s: status=%d want=%d body=%s", what, r.StatusCode, want, b) }