mirror of
https://github.com/coder/coder.git
synced 2026-09-21 20:51:01 +08:00
`TestPush/CachesSubscriptionsWithinTTL` could fail with `Post "http://127.0.0.1:XXXXX": net/http: HTTP/1.x transport connection broken: http: CloseIdleConnections called` when a sibling parallel subtest's `httptest.Server.Close()` ran during an in-flight `Dispatch`. `setupPushTestWithOptions` wired the dispatcher to `http.DefaultClient`, so every parallel subtest in `TestPush` shared `http.DefaultTransport`. `httptest.Server.Close()` calls `CloseIdleConnections` on `http.DefaultTransport`, which could break an in-flight request in any other subtest using the same transport. `httptest.Server` already exposes a paired `*http.Client` backed by a transport dedicated to that server (see `net/http/httptest/server.go`). Closing one server only touches `http.DefaultTransport` and its own client's transport, so sibling cleanup can no longer reach into ours. Same flake class and same isolation principle as #25015, #25407, #25430, and #25821. Closes https://github.com/coder/internal/issues/1593 Closes ENG-2926