Skip to content

chore: attempt to fix windows goleak failures #8753

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 26, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore: attempt to fix windows goleak failures
  • Loading branch information
coadler committed Jul 26, 2023
commit f52f1847c57686a21fcf20087c03af051b16c202
42 changes: 24 additions & 18 deletions cli/templateedit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,9 @@ func TestTemplateEdit(t *testing.T) {

// Otherwise, proxy the request to the real API server.
rp := httputil.NewSingleHostReverseProxy(client.URL)
rp.Transport = &http.Transport{
DisableKeepAlives: true,
}
tp := &http.Transport{}
defer tp.CloseIdleConnections()
rp.Transport = tp
rp.ServeHTTP(w, r)
}))
t.Cleanup(proxy.Close)
Expand All @@ -367,6 +367,7 @@ func TestTemplateEdit(t *testing.T) {
require.NoError(t, err)
proxyClient := codersdk.New(proxyURL)
proxyClient.SetSessionToken(client.SessionToken())
t.Cleanup(proxyClient.HTTPClient.CloseIdleConnections)

cases := []struct {
name string
Expand Down Expand Up @@ -484,9 +485,9 @@ func TestTemplateEdit(t *testing.T) {

// Otherwise, proxy the request to the real API server.
rp := httputil.NewSingleHostReverseProxy(client.URL)
rp.Transport = &http.Transport{
DisableKeepAlives: true,
}
tp := &http.Transport{}
defer tp.CloseIdleConnections()
rp.Transport = tp
rp.ServeHTTP(w, r)
}))
defer proxy.Close()
Expand All @@ -496,6 +497,7 @@ func TestTemplateEdit(t *testing.T) {
require.NoError(t, err)
proxyClient := codersdk.New(proxyURL)
proxyClient.SetSessionToken(client.SessionToken())
t.Cleanup(proxyClient.HTTPClient.CloseIdleConnections)

// Test the cli command.
cmdArgs := []string{
Expand Down Expand Up @@ -604,9 +606,9 @@ func TestTemplateEdit(t *testing.T) {

// Otherwise, proxy the request to the real API server.
rp := httputil.NewSingleHostReverseProxy(client.URL)
rp.Transport = &http.Transport{
DisableKeepAlives: true,
}
tp := &http.Transport{}
defer tp.CloseIdleConnections()
rp.Transport = tp
rp.ServeHTTP(w, r)
}))
defer proxy.Close()
Expand All @@ -616,6 +618,7 @@ func TestTemplateEdit(t *testing.T) {
require.NoError(t, err)
proxyClient := codersdk.New(proxyURL)
proxyClient.SetSessionToken(client.SessionToken())
t.Cleanup(proxyClient.HTTPClient.CloseIdleConnections)

// Test the cli command.
cmdArgs := []string{
Expand Down Expand Up @@ -695,9 +698,9 @@ func TestTemplateEdit(t *testing.T) {

// Otherwise, proxy the request to the real API server.
rp := httputil.NewSingleHostReverseProxy(client.URL)
rp.Transport = &http.Transport{
DisableKeepAlives: true,
}
tp := &http.Transport{}
defer tp.CloseIdleConnections()
rp.Transport = tp
rp.ServeHTTP(w, r)
}))
defer proxy.Close()
Expand All @@ -707,6 +710,7 @@ func TestTemplateEdit(t *testing.T) {
require.NoError(t, err)
proxyClient := codersdk.New(proxyURL)
proxyClient.SetSessionToken(client.SessionToken())
t.Cleanup(proxyClient.HTTPClient.CloseIdleConnections)

// Test the cli command.
cmdArgs := []string{
Expand Down Expand Up @@ -831,9 +835,9 @@ func TestTemplateEdit(t *testing.T) {

// Otherwise, proxy the request to the real API server.
rp := httputil.NewSingleHostReverseProxy(client.URL)
rp.Transport = &http.Transport{
DisableKeepAlives: true,
}
tp := &http.Transport{}
defer tp.CloseIdleConnections()
rp.Transport = tp
rp.ServeHTTP(w, r)
}))
defer proxy.Close()
Expand All @@ -843,6 +847,7 @@ func TestTemplateEdit(t *testing.T) {
require.NoError(t, err)
proxyClient := codersdk.New(proxyURL)
proxyClient.SetSessionToken(client.SessionToken())
t.Cleanup(proxyClient.HTTPClient.CloseIdleConnections)

// Test the cli command with --allow-user-autostart.
cmdArgs := []string{
Expand Down Expand Up @@ -940,9 +945,9 @@ func TestTemplateEdit(t *testing.T) {

// Otherwise, proxy the request to the real API server.
rp := httputil.NewSingleHostReverseProxy(client.URL)
rp.Transport = &http.Transport{
DisableKeepAlives: true,
}
tp := &http.Transport{}
defer tp.CloseIdleConnections()
rp.Transport = tp
rp.ServeHTTP(w, r)
}))
defer proxy.Close()
Expand All @@ -952,6 +957,7 @@ func TestTemplateEdit(t *testing.T) {
require.NoError(t, err)
proxyClient := codersdk.New(proxyURL)
proxyClient.SetSessionToken(client.SessionToken())
t.Cleanup(proxyClient.HTTPClient.CloseIdleConnections)

// Test the cli command.
cmdArgs := []string{
Expand Down