Skip to content

fix(testutil): use dedicated http.Client in OAuth2Config#25407

Open
zedkipp wants to merge 1 commit into
mainfrom
zedkipp/fix-externalauth-validate-flake
Open

fix(testutil): use dedicated http.Client in OAuth2Config#25407
zedkipp wants to merge 1 commit into
mainfrom
zedkipp/fix-externalauth-validate-flake

Conversation

@zedkipp
Copy link
Copy Markdown
Contributor

@zedkipp zedkipp commented May 15, 2026

http.DefaultTransport is shared with httptest.Server, which calls CloseIdleConnections on it during Close. Parallel subtests sharing this transport could see their in-flight requests broken with 'net/http: HTTP/1.x transport connection broken: http: CloseIdleConnections called'. Most visibly this flaked TestExternalAuthCallback/ValidateURL.

Lazily create a dedicated http.Client per OAuth2Config so its idle connection pool is not affected by unrelated httptest.Server.Close calls.

Generated with assistance from Coder Agents.

Relates to coder/internal#835

http.DefaultTransport is shared with httptest.Server, which calls
CloseIdleConnections on it during Close. Parallel subtests sharing
this transport could see their in-flight requests broken with
'net/http: HTTP/1.x transport connection broken: http:
CloseIdleConnections called'. Most visibly this flaked
TestExternalAuthCallback/ValidateURL.

Lazily create a dedicated http.Client per OAuth2Config so its idle
connection pool is not affected by unrelated httptest.Server.Close
calls.
@zedkipp zedkipp marked this pull request as ready for review May 15, 2026 21:22
@zedkipp zedkipp requested a review from Emyrk May 15, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant