fix: poll audit logs to ensure write is last (#6708)

This commit is contained in:
Kyle Carberry
2023-03-21 14:19:09 -05:00
committed by GitHub
parent 71eecb3515
commit 7e854adbb3

View File

@ -1261,8 +1261,12 @@ func TestWorkspaceUpdateAutostart(t *testing.T) {
interval := next.Sub(testCase.at)
require.Equal(t, testCase.expectedInterval, interval, "unexpected interval")
require.Len(t, auditor.AuditLogs, 7)
assert.Equal(t, database.AuditActionWrite, auditor.AuditLogs[6].Action)
require.Eventually(t, func() bool {
if len(auditor.AuditLogs) < 7 {
return false
}
return auditor.AuditLogs[6].Action == database.AuditActionWrite
}, testutil.WaitShort, testutil.IntervalFast)
})
}