Merge pull request #109473 from ii/fix-job-lifecycle-test

Fix crash in E2E Job lifecycle test when the job doesn't have annotations
This commit is contained in:
Kubernetes Prow Robot 2022-04-14 11:17:35 -07:00 committed by GitHub
commit 8dfdbd406b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -577,6 +577,9 @@ var _ = SIGDescribe("Job", func() {
patchedJob, err = jobClient.Get(context.TODO(), jobName, metav1.GetOptions{})
framework.ExpectNoError(err, "Unable to get job %s", jobName)
patchedJob.Spec.Suspend = pointer.BoolPtr(false)
if patchedJob.Annotations == nil {
patchedJob.Annotations = map[string]string{}
}
patchedJob.Annotations["updated"] = "true"
updatedJob, err = e2ejob.UpdateJob(f.ClientSet, ns, patchedJob)
return err