Skip to content
Merged
Changes from all commits
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
26 changes: 16 additions & 10 deletions coderd/workspacebuilds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,14 @@ func TestWorkspaceBuildsProvisionerState(t *testing.T) {
require.NoError(t, err)
coderdtest.AwaitWorkspaceBuildJobCompleted(t, client, build.ID)

// Validate that the deletion was audited.
require.True(t, auditor.Contains(t, database.AuditLog{
ResourceID: build.ID,
Action: database.AuditActionDelete,
}))
// Validate that the deletion was audited. This happens after the transaction
// is committed, so it may not show up in the mock auditor immediately.
testutil.Eventually(ctx, t, func(context.Context) bool {
return auditor.Contains(t, database.AuditLog{
ResourceID: build.ID,
Action: database.AuditActionDelete,
})
}, testutil.IntervalFast)
})

t.Run("NoProvisioners", func(t *testing.T) {
Expand Down Expand Up @@ -535,11 +538,14 @@ func TestWorkspaceBuildsProvisionerState(t *testing.T) {
require.Empty(t, ws)
require.Equal(t, http.StatusGone, coderdtest.SDKError(t, err).StatusCode())

// Validate that the deletion was audited.
require.True(t, auditor.Contains(t, database.AuditLog{
ResourceID: build.ID,
Action: database.AuditActionDelete,
}))
// Validate that the deletion was audited. This happens after the transaction
// is committed, so it may not show up in the mock auditor immediately.
testutil.Eventually(ctx, t, func(context.Context) bool {
return auditor.Contains(t, database.AuditLog{
ResourceID: build.ID,
Action: database.AuditActionDelete,
})
}, testutil.IntervalFast)
})
})
}
Expand Down
Loading