File tree 1 file changed +4
-2
lines changed
coderd/workspaceapps/apptest
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -1765,9 +1765,11 @@ func assertWorkspaceLastUsedAtUpdated(t testing.TB, details *Details) {
1765
1765
require .NotNil (t , details .Workspace , "can't assert LastUsedAt on a nil workspace!" )
1766
1766
before , err := details .SDKClient .Workspace (context .Background (), details .Workspace .ID )
1767
1767
require .NoError (t , err )
1768
- // Wait for stats to fully flush.
1769
- details .FlushStats ()
1770
1768
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 ()
1771
1773
after , err := details .SDKClient .Workspace (context .Background (), details .Workspace .ID )
1772
1774
return assert .NoError (t , err ) && after .LastUsedAt .After (before .LastUsedAt )
1773
1775
}, testutil .WaitShort , testutil .IntervalMedium )
You can’t perform that action at this time.
0 commit comments