Skip to content

Commit e0a623d

Browse files
authored
Merge pull request kubernetes#121538 from mimowo/job-e2e-short-termination-time
Improve execution time of job e2e tests
2 parents 1c8f88d + e50cc47 commit e0a623d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

test/e2e/apps/job.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ var _ = SIGDescribe("Job", func() {
262262
Rules: []batchv1.PodFailurePolicyRule{
263263
{
264264
// Ignore failures of the non 0-indexed pods which fail until the marker file is created
265-
// And the 127 in the 0-indexed pod due to eviction.
265+
// And the 137 in the 0-indexed pod due to eviction.
266266
Action: batchv1.PodFailurePolicyActionIgnore,
267267
OnExitCodes: &batchv1.PodFailurePolicyOnExitCodesRequirement{
268268
Operator: batchv1.PodFailurePolicyOnExitCodesOpIn,

test/e2e/framework/job/fixtures.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import (
2222
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2323
"k8s.io/apimachinery/pkg/util/rand"
2424
"k8s.io/kubernetes/test/e2e/framework"
25+
imageutils "k8s.io/kubernetes/test/utils/image"
26+
"k8s.io/utils/ptr"
2527
)
2628

2729
// NewTestJob returns a Job which does one of several testing behaviors. notTerminate starts a Job that will run
@@ -91,7 +93,7 @@ func NewTestJobOnNode(behavior, name string, rPol v1.RestartPolicy, parallelism,
9193
}
9294
switch behavior {
9395
case "notTerminate":
94-
job.Spec.Template.Spec.Containers[0].Command = []string{"sleep", "1000000"}
96+
job.Spec.Template.Spec.Containers[0].Image = imageutils.GetPauseImageName()
9597
case "fail":
9698
job.Spec.Template.Spec.Containers[0].Command = []string{"/bin/sh", "-c", "exit 1"}
9799
case "failOddSucceedEven":
@@ -126,6 +128,7 @@ func NewTestJobOnNode(behavior, name string, rPol v1.RestartPolicy, parallelism,
126128
// the non-0-indexed pods are succeeded is used to determine that the
127129
// 0th indexed pod already created the marker file.
128130
setupHostPathDirectory(job)
131+
job.Spec.Template.Spec.TerminationGracePeriodSeconds = ptr.To(int64(1))
129132
job.Spec.Template.Spec.Containers[0].Command = []string{"/bin/sh", "-c", "if [[ -r /data/foo ]] ; then exit 0 ; elif [[ $JOB_COMPLETION_INDEX -eq 0 ]] ; then touch /data/foo ; sleep 1000000 ; else exit 1 ; fi"}
130133
}
131134
return job

0 commit comments

Comments
 (0)