|
|
|
@ -4,7 +4,6 @@ Copyright The Helm Authors.
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
@ -273,41 +272,49 @@ func Test_ReadyChecker_jobReady(t *testing.T) {
|
|
|
|
|
name string
|
|
|
|
|
args args
|
|
|
|
|
want bool
|
|
|
|
|
wantErr bool
|
|
|
|
|
}{
|
|
|
|
|
{
|
|
|
|
|
name: "job is completed",
|
|
|
|
|
args: args{job: newJob("foo", 1, intToInt32(1), 1, 0)},
|
|
|
|
|
want: true,
|
|
|
|
|
wantErr: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "job is incomplete",
|
|
|
|
|
args: args{job: newJob("foo", 1, intToInt32(1), 0, 0)},
|
|
|
|
|
want: false,
|
|
|
|
|
wantErr: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "job is failed",
|
|
|
|
|
name: "job is failed but within BackoffLimit",
|
|
|
|
|
args: args{job: newJob("foo", 1, intToInt32(1), 0, 1)},
|
|
|
|
|
want: false,
|
|
|
|
|
wantErr: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "job is completed with retry",
|
|
|
|
|
args: args{job: newJob("foo", 1, intToInt32(1), 1, 1)},
|
|
|
|
|
want: true,
|
|
|
|
|
wantErr: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "job is failed with retry",
|
|
|
|
|
name: "job is failed and beyond BackoffLimit",
|
|
|
|
|
args: args{job: newJob("foo", 1, intToInt32(1), 0, 2)},
|
|
|
|
|
want: false,
|
|
|
|
|
wantErr: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "job is completed single run",
|
|
|
|
|
args: args{job: newJob("foo", 0, intToInt32(1), 1, 0)},
|
|
|
|
|
want: true,
|
|
|
|
|
wantErr: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "job is failed single run",
|
|
|
|
|
args: args{job: newJob("foo", 0, intToInt32(1), 0, 1)},
|
|
|
|
|
want: false,
|
|
|
|
|
wantErr: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "job with null completions",
|
|
|
|
@ -318,7 +325,12 @@ func Test_ReadyChecker_jobReady(t *testing.T) {
|
|
|
|
|
for _, tt := range tests {
|
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
|
c := NewReadyChecker(fake.NewSimpleClientset(), nil)
|
|
|
|
|
if got := c.jobReady(tt.args.job); got != tt.want {
|
|
|
|
|
got, err := c.jobReady(tt.args.job)
|
|
|
|
|
if (err != nil) != tt.wantErr {
|
|
|
|
|
t.Errorf("jobReady() error = %v, wantErr %v", err, tt.wantErr)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if got != tt.want {
|
|
|
|
|
t.Errorf("jobReady() = %v, want %v", got, tt.want)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|