Merge pull request #9313 from jmcelwain/master

wait-for-job with backoff limit 0
pull/9494/head
Josh Dolitsky 4 years ago committed by GitHub
commit 617c9e1b12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -190,7 +190,7 @@ func (w *waiter) isPodReady(pod *corev1.Pod) bool {
}
func (w *waiter) jobReady(job *batchv1.Job) bool {
if job.Status.Failed >= *job.Spec.BackoffLimit {
if job.Status.Failed > *job.Spec.BackoffLimit {
w.log("Job is failed: %s/%s", job.GetNamespace(), job.GetName())
return false
}

@ -266,6 +266,26 @@ func Test_waiter_jobReady(t *testing.T) {
args: args{job: newJob("foo", 1, 1, 0, 1)},
want: false,
},
{
name: "job is completed with retry",
args: args{job: newJob("foo", 1, 1, 1, 1)},
want: true,
},
{
name: "job is failed with retry",
args: args{job: newJob("foo", 1, 1, 0, 2)},
want: false,
},
{
name: "job is completed single run",
args: args{job: newJob("foo", 0, 1, 1, 0)},
want: true,
},
{
name: "job is failed single run",
args: args{job: newJob("foo", 0, 1, 0, 1)},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

Loading…
Cancel
Save