Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5ecb0db

Browse files
authored
chore(coderd): fix test flake in TestAgentWebsocketMonitor_SendPings (#11518)
1 parent5ed3c41 commit5ecb0db

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎coderd/workspaceagentsrpc_internal_test.go‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,21 @@ func TestAgentWebsocketMonitor_BuildOutdated(t *testing.T) {
219219

220220
funcTestAgentWebsocketMonitor_SendPings(t*testing.T) {
221221
t.Parallel()
222-
ctx:=testutil.Context(t,testutil.WaitShort)
222+
ctx,cancel:=context.WithTimeout(context.Background(),testutil.WaitShort)
223+
t.Cleanup(cancel)
223224
fConn:=&fakePingerCloser{}
224225
uut:=&agentWebsocketMonitor{
225226
pingPeriod:testutil.IntervalFast,
226227
conn:fConn,
227228
}
228-
gouut.sendPings(ctx)
229+
done:=make(chanstruct{})
230+
gofunc() {
231+
uut.sendPings(ctx)
232+
close(done)
233+
}()
229234
fConn.requireEventuallyHasPing(t)
235+
cancel()
236+
<-done
230237
lastPing:=uut.lastPing.Load()
231238
require.NotNil(t,lastPing)
232239
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp