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

Commit3b7380f

Browse files
authored
fix: fix race in assertWorkspaceLastUsedAtUpdated (#12899)
fixes#12789Stats are collected asynchronously with respect to sessions ending. Flush repeatedly so that we pick up the collection if we missed it.
1 parentf96ce80 commit3b7380f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎coderd/workspaceapps/apptest/apptest.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,9 +1765,11 @@ func assertWorkspaceLastUsedAtUpdated(t testing.TB, details *Details) {
17651765
require.NotNil(t,details.Workspace,"can't assert LastUsedAt on a nil workspace!")
17661766
before,err:=details.SDKClient.Workspace(context.Background(),details.Workspace.ID)
17671767
require.NoError(t,err)
1768-
// Wait for stats to fully flush.
1769-
details.FlushStats()
17701768
require.Eventually(t,func()bool {
1769+
// We may need to flush multiple times, since the stats from the app we are testing might be
1770+
// collected asynchronously from when we see the connection close, and thus, could race
1771+
// against being flushed.
1772+
details.FlushStats()
17711773
after,err:=details.SDKClient.Workspace(context.Background(),details.Workspace.ID)
17721774
returnassert.NoError(t,err)&&after.LastUsedAt.After(before.LastUsedAt)
17731775
},testutil.WaitShort,testutil.IntervalMedium)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp