Skip to content

Commit 351f4c6

Browse files
authored
test: stop leaking goroutine (#74)
Detected by uber-go/goleak as part of continued investigation into flaky test suite (#72)
1 parent 322a83a commit 351f4c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

websocket_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,11 @@ func TestHandshake(t *testing.T) {
123123
t.Parallel()
124124

125125
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
126-
ws, err := websocket.Accept(w, r, websocket.Options{})
126+
_, err := websocket.Accept(w, r, websocket.Options{})
127127
if err != nil {
128128
http.Error(w, err.Error(), http.StatusBadRequest)
129129
return
130130
}
131-
_ = ws.Handle(r.Context(), websocket.EchoHandler)
132131
}))
133132
defer srv.Close()
134133

@@ -139,6 +138,7 @@ func TestHandshake(t *testing.T) {
139138

140139
resp, err := http.DefaultClient.Do(req)
141140
assert.NilError(t, err)
141+
defer func() { _ = resp.Body.Close() }()
142142

143143
assert.Equal(t, resp.StatusCode, tc.wantStatus, "incorrect status code")
144144
for k, v := range tc.wantRespHeaders {

0 commit comments

Comments
 (0)