Skip to content

Commit ec983bd

Browse files
committed
Use Consistently in the e2e for Job
1 parent 70a8ceb commit ec983bd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

test/e2e/apps/job.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,12 +1257,11 @@ done`}
12571257
framework.ExpectNoError(err, "failed to create job in namespace: %s/%s", job.Namespace, job.Name)
12581258

12591259
ginkgo.By(fmt.Sprintf("Verify the Job %s/%s status isn't updated by the built-in controller", job.Namespace, job.Name))
1260-
// Wait a little to give the built-in Job controller time to update the
1261-
// status (if it was enabled)
1262-
time.Sleep(time.Second)
1263-
job, err = e2ejob.GetJob(ctx, f.ClientSet, f.Namespace.Name, job.Name)
1264-
framework.ExpectNoError(err, "failed to get the latest object for the Job %s/%s", job.Namespace, job.Name)
1265-
gomega.Expect(job.Status).To(gomega.BeEquivalentTo(batchv1.JobStatus{}), "expected status for the Job %s/%s to be empty", job.Namespace, job.Name)
1260+
// This get function uses HandleRetry to retry on transient API errors
1261+
get := framework.GetObject(f.ClientSet.BatchV1().Jobs(f.Namespace.Name).Get, job.Name, metav1.GetOptions{})
1262+
gomega.Consistently(ctx, get).
1263+
WithPolling(time.Second).WithTimeout(3 * time.Second).
1264+
Should(gomega.HaveField("Status", gomega.BeEquivalentTo(batchv1.JobStatus{})))
12661265
})
12671266
})
12681267

0 commit comments

Comments
 (0)