diff --git a/test/e2e/framework/job/fixtures.go b/test/e2e/framework/job/fixtures.go index 27c46289043..6514bb3e243 100644 --- a/test/e2e/framework/job/fixtures.go +++ b/test/e2e/framework/job/fixtures.go @@ -92,6 +92,12 @@ func NewTestJobOnNode(behavior, name string, rPol v1.RestartPolicy, parallelism, } } switch behavior { + case "neverTerminate": + // this job is being used in an upgrade job see test/e2e/upgrades/apps/job.go + // it should never be optimized, as it always has to restart during an upgrade + // and continue running + job.Spec.Template.Spec.Containers[0].Command = []string{"sleep", "1000000"} + job.Spec.Template.Spec.TerminationGracePeriodSeconds = ptr.To(int64(1)) case "notTerminate": job.Spec.Template.Spec.Containers[0].Image = imageutils.GetPauseImageName() case "fail": diff --git a/test/e2e/upgrades/apps/job.go b/test/e2e/upgrades/apps/job.go index eb59b4a8cdc..4c1b6e1b298 100644 --- a/test/e2e/upgrades/apps/job.go +++ b/test/e2e/upgrades/apps/job.go @@ -47,7 +47,7 @@ func (t *JobUpgradeTest) Setup(ctx context.Context, f *framework.Framework) { t.namespace = f.Namespace.Name ginkgo.By("Creating a job") - t.job = e2ejob.NewTestJob("notTerminate", "foo", v1.RestartPolicyOnFailure, 2, 2, nil, 6) + t.job = e2ejob.NewTestJob("neverTerminate", "foo", v1.RestartPolicyOnFailure, 2, 2, nil, 6) job, err := e2ejob.CreateJob(ctx, f.ClientSet, t.namespace, t.job) t.job = job framework.ExpectNoError(err)