From a68122ca307b5b9be5b890cb9c12555d6951a258 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Tue, 23 Sep 2025 16:53:53 +0100 Subject: [PATCH] chore: fix Test_Runner/CleanupPendingBuild with testutil.Eventually (#19924) Fixes https://github.com/coder/internal/issues/968 --- scaletest/createworkspaces/run_test.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scaletest/createworkspaces/run_test.go b/scaletest/createworkspaces/run_test.go index 88992c4226..950ca7a7ea 100644 --- a/scaletest/createworkspaces/run_test.go +++ b/scaletest/createworkspaces/run_test.go @@ -264,7 +264,7 @@ func Test_Runner(t *testing.T) { // Wait for the workspace build job to be picked up. checkJobStartedCtx := testutil.Context(t, testutil.WaitLong) jobCh := make(chan codersdk.ProvisionerJob, 1) - require.Eventually(t, func() bool { + testutil.Eventually(checkJobStartedCtx, t, func(ctx context.Context) bool { workspaces, err := client.Workspaces(checkJobStartedCtx, codersdk.WorkspaceFilter{}) if err != nil { return false @@ -286,7 +286,7 @@ func Test_Runner(t *testing.T) { } jobCh <- ws.LatestBuild.Job return true - }, testutil.WaitLong, testutil.IntervalSlow) + }, testutil.IntervalSlow) t.Log("canceling scaletest workspace creation") runnerCancel() @@ -308,9 +308,8 @@ func Test_Runner(t *testing.T) { }() // Ensure the job has been marked as canceled - checkJobCanceledCtx := testutil.Context(t, testutil.WaitLong) - require.Eventually(t, func() bool { - pj, err := client.OrganizationProvisionerJob(checkJobCanceledCtx, runningJob.OrganizationID, runningJob.ID) + testutil.Eventually(cleanupCtx, t, func(ctx context.Context) bool { + pj, err := client.OrganizationProvisionerJob(ctx, runningJob.OrganizationID, runningJob.ID) if !assert.NoError(t, err) { return false } @@ -324,7 +323,7 @@ func Test_Runner(t *testing.T) { } return true - }, testutil.WaitLong, testutil.IntervalSlow) + }, testutil.IntervalSlow) cleanupCancel() <-done cleanupLogsStr := cleanupLogs.String()