Skip to content

Commit

Permalink
WIP: JobTest: TestSuccessPolicy_GetCompleteConditionAfterAllPodsAreTe…
Browse files Browse the repository at this point in the history
…rminated

Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
  • Loading branch information
tenzen-y committed Mar 7, 2024
1 parent 38e58e3 commit aa0ef26
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions test/integration/job/job_test.go
Expand Up @@ -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.
Expand Down

0 comments on commit aa0ef26

Please sign in to comment.