mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 14:07:14 +00:00
Format helper scripts in Job e2e tests as multiline for readability
This commit is contained in:
parent
24fbb13eaf
commit
2d680054c1
@ -126,7 +126,16 @@ func NewTestJobOnNode(behavior, name string, rPol v1.RestartPolicy, parallelism,
|
|||||||
// ensure all job pods run on a single node and the volume
|
// ensure all job pods run on a single node and the volume
|
||||||
// will be mounted from a hostPath instead.
|
// will be mounted from a hostPath instead.
|
||||||
setupHostPathDirectory(job)
|
setupHostPathDirectory(job)
|
||||||
job.Spec.Template.Spec.Containers[0].Command = []string{"/bin/sh", "-c", "if [[ -r /data/foo ]] ; then exit 0 ; else touch /data/foo ; exit 1 ; fi"}
|
job.Spec.Template.Spec.Containers[0].Command = []string{"/bin/sh", "-c"}
|
||||||
|
job.Spec.Template.Spec.Containers[0].Args = []string{`
|
||||||
|
if [[ -r /data/foo ]]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
touch /data/foo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
`}
|
||||||
case "notTerminateOnce":
|
case "notTerminateOnce":
|
||||||
// Do not terminate the 0-indexed pod in the first run and
|
// Do not terminate the 0-indexed pod in the first run and
|
||||||
// succeed the second time. Fail the non-0-indexed pods until
|
// succeed the second time. Fail the non-0-indexed pods until
|
||||||
@ -135,7 +144,19 @@ func NewTestJobOnNode(behavior, name string, rPol v1.RestartPolicy, parallelism,
|
|||||||
// 0th indexed pod already created the marker file.
|
// 0th indexed pod already created the marker file.
|
||||||
setupHostPathDirectory(job)
|
setupHostPathDirectory(job)
|
||||||
job.Spec.Template.Spec.TerminationGracePeriodSeconds = ptr.To(int64(1))
|
job.Spec.Template.Spec.TerminationGracePeriodSeconds = ptr.To(int64(1))
|
||||||
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"}
|
job.Spec.Template.Spec.Containers[0].Command = []string{"/bin/sh", "-c"}
|
||||||
|
job.Spec.Template.Spec.Containers[0].Args = []string{`
|
||||||
|
if [[ -r /data/foo ]]
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
elif [[ $JOB_COMPLETION_INDEX -eq 0 ]]
|
||||||
|
then
|
||||||
|
touch /data/foo
|
||||||
|
sleep 1000000
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
`}
|
||||||
}
|
}
|
||||||
return job
|
return job
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user