mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Merge pull request #76315 from globervinodhn/new_e2e_removejobpods
New E2E proposal: Validate that all the pods are removed when the job is deleted
This commit is contained in:
commit
ce2836831f
@ -59,6 +59,30 @@ var _ = SIGDescribe("Job", func() {
|
||||
}
|
||||
})
|
||||
|
||||
/*
|
||||
Testcase: Ensure that the pods associated with the job are removed once the job is deleted
|
||||
Description: Create a job and ensure the associated pod count is equal to paralellism count. Delete the
|
||||
job and ensure if the pods associated with the job have been removed
|
||||
*/
|
||||
ginkgo.It("should remove pods when job is deleted", func() {
|
||||
ginkgo.By("Creating a job")
|
||||
job := jobutil.NewTestJob("notTerminate", "all-pods-removed", v1.RestartPolicyNever, parallelism, completions, nil, backoffLimit)
|
||||
job, err := jobutil.CreateJob(f.ClientSet, f.Namespace.Name, job)
|
||||
framework.ExpectNoError(err, "failed to create job in namespace: %s", f.Namespace.Name)
|
||||
|
||||
ginkgo.By("Ensure pods equal to paralellism count is attached to the job")
|
||||
err = jobutil.WaitForAllJobPodsRunning(f.ClientSet, f.Namespace.Name, job.Name, parallelism)
|
||||
framework.ExpectNoError(err, "failed to ensure number of pods associated with job %s is equal to parallelism count in namespace: %s", job.Name, f.Namespace.Name)
|
||||
|
||||
ginkgo.By("Delete the job")
|
||||
err = framework.DeleteResourceAndWaitForGC(f.ClientSet, batchinternal.Kind("Job"), f.Namespace.Name, job.Name)
|
||||
framework.ExpectNoError(err, "failed to delete the job in namespace: %s", f.Namespace.Name)
|
||||
|
||||
ginkgo.By("Ensure the pods associated with the job are also deleted")
|
||||
err = jobutil.WaitForAllJobPodsGone(f.ClientSet, f.Namespace.Name, job.Name)
|
||||
framework.ExpectNoError(err, "failed to get PodList for job %s in namespace: %s", job.Name, f.Namespace.Name)
|
||||
})
|
||||
|
||||
// Pods sometimes fail, but eventually succeed.
|
||||
ginkgo.It("should run a job to completion when tasks sometimes fail and are locally restarted", func() {
|
||||
ginkgo.By("Creating a job")
|
||||
|
Loading…
Reference in New Issue
Block a user