We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentf96ce80 commit3b7380fCopy full SHA for 3b7380f
coderd/workspaceapps/apptest/apptest.go
@@ -1765,9 +1765,11 @@ func assertWorkspaceLastUsedAtUpdated(t testing.TB, details *Details) {
1765
require.NotNil(t,details.Workspace,"can't assert LastUsedAt on a nil workspace!")
1766
before,err:=details.SDKClient.Workspace(context.Background(),details.Workspace.ID)
1767
require.NoError(t,err)
1768
-// Wait for stats to fully flush.
1769
-details.FlushStats()
1770
require.Eventually(t,func()bool {
+// We may need to flush multiple times, since the stats from the app we are testing might be
+// collected asynchronously from when we see the connection close, and thus, could race
1771
+// against being flushed.
1772
+details.FlushStats()
1773
after,err:=details.SDKClient.Workspace(context.Background(),details.Workspace.ID)
1774
returnassert.NoError(t,err)&&after.LastUsedAt.After(before.LastUsedAt)
1775
},testutil.WaitShort,testutil.IntervalMedium)