mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: remove initial global HTTP client usage (#20128)
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 https://github.com/coder/internal/issues/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. This should have some impact to reduce test flakiness.
This commit is contained in:
+4
-2
@@ -1254,8 +1254,9 @@ func TestServer(t *testing.T) {
|
||||
t.Logf("error creating request: %s", err.Error())
|
||||
return false
|
||||
}
|
||||
client := &http.Client{}
|
||||
// nolint:bodyclose
|
||||
res, err := http.DefaultClient.Do(req)
|
||||
res, err := client.Do(req)
|
||||
if err != nil {
|
||||
t.Logf("error hitting prometheus endpoint: %s", err.Error())
|
||||
return false
|
||||
@@ -1316,8 +1317,9 @@ func TestServer(t *testing.T) {
|
||||
t.Logf("error creating request: %s", err.Error())
|
||||
return false
|
||||
}
|
||||
client := &http.Client{}
|
||||
// nolint:bodyclose
|
||||
res, err := http.DefaultClient.Do(req)
|
||||
res, err := client.Do(req)
|
||||
if err != nil {
|
||||
t.Logf("error hitting prometheus endpoint: %s", err.Error())
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user