Skip to content

Conversation

@zedkipp
Copy link
Contributor

@zedkipp zedkipp commented Oct 1, 2025

This PR makes the initial steps at removing usage of the global Go HTTP client, which was seen to have impacts on test flakiness in coder/internal#1020. The first commit removes uses from tests, with the exception of one test that is tightly coupled to the default client. The second commit makes easy/low-risk removals from application code (I'm new to the project). This should have some impact to reduce flakiness.

This commit is an effort to further isolate tests by removing
shared used of the global default HTTP client.
Make easy, low-risk removals of default HTTP client usage.
Some application code calls CloseIdleConnections on the default HTTP
client which can cause other code under test using the default HTTP
client to be impacted. This should reduce test flakiness.
@github-actions
Copy link

github-actions bot commented Oct 1, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@zedkipp
Copy link
Contributor Author

zedkipp commented Oct 1, 2025

I have read the CLA Document and I hereby sign the CLA

cdrci2 added a commit to coder/cla that referenced this pull request Oct 1, 2025
@zedkipp zedkipp changed the title fix: initial removal of global HTTP client usage fix: remove initial global HTTP client usage Oct 2, 2025
@zedkipp zedkipp marked this pull request as ready for review October 2, 2025 14:55
Copy link
Contributor

@buenos-nachos buenos-nachos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good to me, but I'd rather this get a second opinion from someone with more backend context

(Also, for future reference, Kayla and I got tagged as code owners because the PR changed a file in /site, but the main intent for that check is to get more eyes on the TypeScript parts of the codebase. Kayla can absolutely hold her own when it comes to backend stuff – I'm definitely still getting my feet wet, though, so I'm going to be less useful. I'd say that if you're not updating any TypeScript code, you can go ahead and tag any backend engineer for changes like these.)

@zedkipp zedkipp requested a review from bcpeinhardt October 2, 2025 16:07
@bcpeinhardt
Copy link
Contributor

Nice 😎 It looks good to me. I went looking for other types of invocations that might use the default client (like http.Get etc.) but didn't find any.

Might be a good opportunity to start documenting some testing practices in the CONTRIBUTING guide (using NewRequestWithContext and a new client etc.), but doesn't need to be on this PR.

@zedkipp zedkipp merged commit 4d1003e into main Oct 2, 2025
76 of 79 checks passed
@zedkipp zedkipp deleted the zedkipp/initial-rm-global-http-client branch October 2, 2025 17:43
@github-actions github-actions bot locked and limited conversation to collaborators Oct 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants