diff --git a/test/integration/job/job_test.go b/test/integration/job/job_test.go index 32e28edd0d16b..9e8a56ae28291 100644 --- a/test/integration/job/job_test.go +++ b/test/integration/job/job_test.go @@ -825,10 +825,20 @@ func TestSuccessPolicy_GetCompleteConditionAfterAllPodsAreTerminated(t *testing. }) validateIndexedJobPods(ctx, t, clientSet, jobObj, sets.New[int](), "0", nil) - // Verify the job has "SuccessCriteriaMet" and doesn't have "Complete" since all pods are still counting. - validateJobCondition(ctx, t, clientSet, jobObj, batchv1.JobSuccessCriteriaMet) - if getJobConditionStatus(ctx, jobObj, batchv1.JobComplete) != "" { - t.Fatalf("Should not get Complete condition, yet") + if err = wait.PollUntilContextTimeout(ctx, 10*time.Millisecond, time.Minute, true, func(ctx context.Context) (bool, error) { + job, err := clientSet.BatchV1().Jobs(jobObj.Namespace).Get(ctx, jobObj.Name, metav1.GetOptions{}) + if err != nil { + return true, err + } + if getJobConditionStatus(ctx, job, batchv1.JobSuccessCriteriaMet) != v1.ConditionTrue { + return true, nil + } + if getJobConditionStatus(ctx, job, batchv1.JobComplete) != "" { + t.Fatalf("Should not added Complete condition, yet") + } + return false, nil + }); err != nil { + t.Fatalf("Job should have only SuccessCriteriaMet, and should not have Complete") } // Verify if the Job get Complete condition after the next reconciliation.