Use Consistently in the e2e for Job

This commit is contained in:
Michal Wozniak 2024-10-16 18:45:11 +02:00
parent 70a8ceb6f0
commit ec983bd3fb

View File

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