mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: fix Test_Runner/CleanupPendingBuild with testutil.Eventually (#19924)
Fixes https://github.com/coder/internal/issues/968
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user