-
Notifications
You must be signed in to change notification settings - Fork 0
stop using the default, global HTTP client to avoid CloseIdleConnections flakes #1020
Copy link
Copy link
Open
Description
Some places in coder/coder, like this, use the default, global HTTP client:
resp, err := http.DefaultClient.Do(req)
if err != nil {
return xerrors.Errorf("perform request: %w", err)
}This causes flakes in our tests with the message net/http: HTTP/1.x transport connection broken: http: CloseIdleConnections called:
error= perform request:
github.com/coder/coder/v2/coderd/telemetry.(*remoteReporter).deployment
/Users/runner/work/coder/coder/coderd/telemetry/telemetry.go:355
- Post "http://127.0.0.1:56934/deployment": net/http: HTTP/1.x transport connection broken: http: CloseIdleConnections called
I think the flake manifests when a test running in parallel in the same package calls CloseIdleConnections on the default client.
To avoid the flakes, we should refactor our code to stop using the global HTTP client and use local instances instead.
Related issues:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels