Skip to content

Commit 7e854ad

Browse files
authored
fix: poll audit logs to ensure write is last (#6708)
1 parent 71eecb3 commit 7e854ad

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

coderd/workspaces_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,8 +1261,12 @@ func TestWorkspaceUpdateAutostart(t *testing.T) {
12611261
interval := next.Sub(testCase.at)
12621262
require.Equal(t, testCase.expectedInterval, interval, "unexpected interval")
12631263

1264-
require.Len(t, auditor.AuditLogs, 7)
1265-
assert.Equal(t, database.AuditActionWrite, auditor.AuditLogs[6].Action)
1264+
require.Eventually(t, func() bool {
1265+
if len(auditor.AuditLogs) < 7 {
1266+
return false
1267+
}
1268+
return auditor.AuditLogs[6].Action == database.AuditActionWrite
1269+
}, testutil.WaitShort, testutil.IntervalFast)
12661270
})
12671271
}
12681272

0 commit comments

Comments
 (0)