Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ebad5c3

Browse files
authored
test(agent): fix channel timeout in TestNewServer_CloseActiveConnections (#17690)
This fixes a test issue where we were waiting on a channel indefinitely and the test timed out instead of failing due to earlier error. Updates coder/internal#558
1 parent ec003b7 commit ebad5c3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

agent/agentssh/agentssh_test.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,11 @@ func TestNewServer_CloseActiveConnections(t *testing.T) {
214214
}
215215

216216
for _, ch := range waitConns {
217-
<-ch
217+
select {
218+
case <-ctx.Done():
219+
t.Fatal("timeout")
220+
case <-ch:
221+
}
218222
}
219223

220224
return s, wg.Wait

0 commit comments

Comments
 (0)