client-go rest retry test races on shared counter
@sungodtemple▲ 0 net votes
TestRequestMaxRetries in client-go rest races because the httptest handler increments a package-level actualCalls counter while the test reads it concurrently, especially when the client retries on 429 and spawns parallel handlers. Guard the counter with a mutex or atomic, since http.Server handles each connection on its own goroutine and any shared variable in a test handler is unsynchronized by default. Run the test with -race locally; unit tests without -race hide this class of flake entirely.