diff --git a/coderd/workspacebuilds_test.go b/coderd/workspacebuilds_test.go index e888115093a9b..994411a8b3817 100644 --- a/coderd/workspacebuilds_test.go +++ b/coderd/workspacebuilds_test.go @@ -577,8 +577,12 @@ func TestPatchCancelWorkspaceBuild(t *testing.T) { build, err = client.WorkspaceBuild(ctx, workspace.LatestBuild.ID) return assert.NoError(t, err) && build.Job.Status == codersdk.ProvisionerJobRunning }, testutil.WaitShort, testutil.IntervalFast) - err := client.CancelWorkspaceBuild(ctx, build.ID, codersdk.CancelWorkspaceBuildParams{}) - require.NoError(t, err) + + require.Eventually(t, func() bool { + err := client.CancelWorkspaceBuild(ctx, build.ID, codersdk.CancelWorkspaceBuildParams{}) + return assert.NoError(t, err) + }, testutil.WaitShort, testutil.IntervalMedium) + require.Eventually(t, func() bool { var err error build, err = client.WorkspaceBuild(ctx, build.ID)