Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1ee6b8d

Browse files
authored
chore: fix flake in TestWorkspaceBuildsProvisionerState (#18839)
Fixescoder/internal#761
1 parent7c077d3 commit1ee6b8d

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

‎coderd/workspacebuilds_test.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,14 @@ func TestWorkspaceBuildsProvisionerState(t *testing.T) {
494494
require.NoError(t,err)
495495
coderdtest.AwaitWorkspaceBuildJobCompleted(t,client,build.ID)
496496

497-
// Validate that the deletion was audited.
498-
require.True(t,auditor.Contains(t, database.AuditLog{
499-
ResourceID:build.ID,
500-
Action:database.AuditActionDelete,
501-
}))
497+
// Validate that the deletion was audited. This happens after the transaction
498+
// is committed, so it may not show up in the mock auditor immediately.
499+
testutil.Eventually(ctx,t,func(context.Context)bool {
500+
returnauditor.Contains(t, database.AuditLog{
501+
ResourceID:build.ID,
502+
Action:database.AuditActionDelete,
503+
})
504+
},testutil.IntervalFast)
502505
})
503506

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

538-
// Validate that the deletion was audited.
539-
require.True(t,auditor.Contains(t, database.AuditLog{
540-
ResourceID:build.ID,
541-
Action:database.AuditActionDelete,
542-
}))
541+
// Validate that the deletion was audited. This happens after the transaction
542+
// is committed, so it may not show up in the mock auditor immediately.
543+
testutil.Eventually(ctx,t,func(context.Context)bool {
544+
returnauditor.Contains(t, database.AuditLog{
545+
ResourceID:build.ID,
546+
Action:database.AuditActionDelete,
547+
})
548+
},testutil.IntervalFast)
543549
})
544550
})
545551
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp