Skip to content

Commit 78eecfb

Browse files
committed
instead of sleep use eventually
1 parent 9b37924 commit 78eecfb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

coderd/workspacebuilds_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,11 @@ func TestPatchCancelWorkspaceBuild(t *testing.T) {
578578
return assert.NoError(t, err) && build.Job.Status == codersdk.ProvisionerJobRunning
579579
}, testutil.WaitShort, testutil.IntervalFast)
580580

581-
time.Sleep(testutil.IntervalMedium)
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)
582585

583-
err := client.CancelWorkspaceBuild(ctx, build.ID, codersdk.CancelWorkspaceBuildParams{})
584-
require.NoError(t, err)
585586
require.Eventually(t, func() bool {
586587
var err error
587588
build, err = client.WorkspaceBuild(ctx, build.ID)

0 commit comments

Comments
 (0)