Skip to content

Commit 74fb2aa

Browse files
authored
fix: fix flake in TestPatchCancelWorkspaceBuild/User_is_allowed_to_cancel (coder#19522)
Fixes: coder/internal#885
1 parent 33509f2 commit 74fb2aa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

coderd/workspacebuilds_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,12 @@ func TestPatchCancelWorkspaceBuild(t *testing.T) {
577577
build, err = client.WorkspaceBuild(ctx, workspace.LatestBuild.ID)
578578
return assert.NoError(t, err) && build.Job.Status == codersdk.ProvisionerJobRunning
579579
}, testutil.WaitShort, testutil.IntervalFast)
580-
err := client.CancelWorkspaceBuild(ctx, build.ID, codersdk.CancelWorkspaceBuildParams{})
581-
require.NoError(t, err)
580+
581+
require.Eventually(t, func() bool {
582+
err := client.CancelWorkspaceBuild(ctx, build.ID, codersdk.CancelWorkspaceBuildParams{})
583+
return assert.NoError(t, err)
584+
}, testutil.WaitShort, testutil.IntervalMedium)
585+
582586
require.Eventually(t, func() bool {
583587
var err error
584588
build, err = client.WorkspaceBuild(ctx, build.ID)

0 commit comments

Comments
 (0)