Skip to content

chore(coderd/workspaceapps/apptest): fix test flake due to concurrent usage of same deployment #12700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! chore(coderd/workspaceapps/apptest): fix test flake due to con…
…current usage of same deployment
  • Loading branch information
johnstcn committed Mar 21, 2024
commit ea99e19a8db4d616bdcaa34a46287ee6107e5164
7 changes: 4 additions & 3 deletions coderd/workspaceapps/apptest/apptest.go
Original file line number Diff line number Diff line change
Expand Up @@ -1766,9 +1766,10 @@ func assertWorkspaceLastUsedAtUpdated(t testing.TB, details *Details) {
require.NoError(t, err)
// Wait for stats to fully flush.
details.FlushStats()
after, err := details.SDKClient.Workspace(context.Background(), details.Workspace.ID)
require.NoError(t, err)
require.Greater(t, after.LastUsedAt, before.LastUsedAt, "workspace LastUsedAt not updated when it should have been")
require.Eventually(t, func() bool {
after, err := details.SDKClient.Workspace(context.Background(), details.Workspace.ID)
return assert.NoError(t, err) && after.LastUsedAt.After(before.LastUsedAt)
}, testutil.WaitShort, testutil.IntervalMedium)
}

// Except when it sometimes shouldn't (e.g. no access)
Expand Down