@@ -13,6 +13,11 @@ import (
13
13
"strings"
14
14
"testing"
15
15
16
+ "github.com/go-chi/chi/v5"
17
+ "github.com/google/uuid"
18
+ "github.com/stretchr/testify/require"
19
+ "go.uber.org/mock/gomock"
20
+
16
21
"cdr.dev/slog"
17
22
"cdr.dev/slog/sloggers/slogtest"
18
23
"github.com/coder/coder/v2/coderd/database"
@@ -28,10 +33,6 @@ import (
28
33
"github.com/coder/coder/v2/tailnet/tailnettest"
29
34
"github.com/coder/coder/v2/testutil"
30
35
"github.com/coder/websocket"
31
- "github.com/go-chi/chi/v5"
32
- "github.com/google/uuid"
33
- "github.com/stretchr/testify/require"
34
- "go.uber.org/mock/gomock"
35
36
)
36
37
37
38
type fakeAgentProvider struct {
@@ -143,8 +144,11 @@ func TestWatchAgentContainers(t *testing.T) {
143
144
144
145
// And: Dial the WebSocket
145
146
wsURL := strings .Replace (srv .URL , "http://" , "ws://" , 1 )
146
- conn , _ , err := websocket .Dial (ctx , fmt .Sprintf ("%s/workspaceagents/%s/containers/watch" , wsURL , agentID ), nil )
147
+ conn , resp , err := websocket .Dial (ctx , fmt .Sprintf ("%s/workspaceagents/%s/containers/watch" , wsURL , agentID ), nil )
147
148
require .NoError (t , err )
149
+ if resp .Body != nil {
150
+ defer resp .Body .Close ()
151
+ }
148
152
149
153
// And: Create a streaming decoder
150
154
decoder := wsjson .NewDecoder [codersdk.WorkspaceAgentListContainersResponse ](conn , websocket .MessageText , logger )
0 commit comments