@@ -146,10 +146,10 @@ var _ = SIGDescribe("Job", func() {
146
146
/*
147
147
Testname: Ensure pod failure policy allows to ignore failure matching on the exit code
148
148
Description: This test is using an indexed job. The pod corresponding to each index
149
- creates a marker file on the host and runs 'forever' until evicted. Once
150
- the marker file is created the pod succeeds seeing it on restart. Thus,
151
- we trigger one failure per index due to eviction , so the Job would be
152
- marked as failed, if not for the ignore rule matching on exit codes.
149
+ creates a marker file on the host and fails. Once the marker file is
150
+ created the pod succeeds seeing it on restart. Thus, we trigger one
151
+ failure per index, so the Job would be marked as failed, if not for the
152
+ ignore rule matching on exit codes.
153
153
*/
154
154
ginkgo .It ("should allow to use a pod failure policy to ignore failure matching on exit code" , func (ctx context.Context ) {
155
155
// We set the backoffLimit = numPods-1 so that we can tolerate random
@@ -165,53 +165,22 @@ var _ = SIGDescribe("Job", func() {
165
165
framework .ExpectNoError (err )
166
166
167
167
ginkgo .By ("Creating a job" )
168
- job := e2ejob .NewTestJobOnNode ("notTerminateOncePerIndex " , "evicted -pod-ignore-on-exit-code" , v1 .RestartPolicyNever , parallelism , completions , nil , backoffLimit , node .Name )
168
+ job := e2ejob .NewTestJobOnNode ("failOncePerIndex " , "fail -pod-ignore-on-exit-code" , v1 .RestartPolicyNever , parallelism , completions , nil , backoffLimit , node .Name )
169
169
job .Spec .CompletionMode = ptr .To (batchv1 .IndexedCompletion )
170
170
job .Spec .PodFailurePolicy = & batchv1.PodFailurePolicy {
171
171
Rules : []batchv1.PodFailurePolicyRule {
172
172
{
173
- // Ignore the pod failure caused by the eviction based on the
174
- // exit code corresponding to SIGKILL.
175
173
Action : batchv1 .PodFailurePolicyActionIgnore ,
176
174
OnExitCodes : & batchv1.PodFailurePolicyOnExitCodesRequirement {
177
175
Operator : batchv1 .PodFailurePolicyOnExitCodesOpIn ,
178
- Values : []int32 {137 },
176
+ Values : []int32 {42 },
179
177
},
180
178
},
181
179
},
182
180
}
183
181
job , err = e2ejob .CreateJob (ctx , f .ClientSet , f .Namespace .Name , job )
184
182
framework .ExpectNoError (err , "failed to create job in namespace: %s" , f .Namespace .Name )
185
183
186
- ginkgo .By ("Waiting for all the pods to be ready" )
187
- err = e2ejob .WaitForJobReady (ctx , f .ClientSet , f .Namespace .Name , job .Name , ptr .To (int32 (numPods )))
188
- framework .ExpectNoError (err , "failed to await for all pods to be ready for job: %s/%s" , job .Name , job .Namespace )
189
-
190
- ginkgo .By ("Fetch all running pods" )
191
- pods , err := e2ejob .GetAllRunningJobPods (ctx , f .ClientSet , f .Namespace .Name , job .Name )
192
- framework .ExpectNoError (err , "failed to get running pods for the job: %s/%s" , job .Name , job .Namespace )
193
- gomega .Expect (pods ).To (gomega .HaveLen (numPods ), "Number of running pods doesn't match parallelism" )
194
-
195
- ginkgo .By ("Evict all the Pods" )
196
- workqueue .ParallelizeUntil (ctx , numPods , numPods , func (index int ) {
197
- defer ginkgo .GinkgoRecover ()
198
-
199
- pod := pods [index ]
200
- ginkgo .By (fmt .Sprintf ("Evicting the running pod: %s/%s" , pod .Name , pod .Namespace ))
201
- evictTarget := & policyv1.Eviction {
202
- ObjectMeta : metav1.ObjectMeta {
203
- Name : pod .Name ,
204
- Namespace : pod .Namespace ,
205
- },
206
- }
207
- err = f .ClientSet .CoreV1 ().Pods (pod .Namespace ).EvictV1 (ctx , evictTarget )
208
- framework .ExpectNoError (err , "failed to evict the pod: %s/%s" , pod .Name , pod .Namespace )
209
-
210
- ginkgo .By (fmt .Sprintf ("Awaiting for the pod: %s/%s to be deleted" , pod .Name , pod .Namespace ))
211
- err = e2epod .WaitForPodNotFoundInNamespace (ctx , f .ClientSet , pod .Name , pod .Namespace , f .Timeouts .PodDelete )
212
- framework .ExpectNoError (err , "failed to await for all pods to be deleted: %s/%s" , pod .Name , pod .Namespace )
213
- })
214
-
215
184
ginkgo .By ("Ensuring job reaches completions" )
216
185
err = e2ejob .WaitForJobComplete (ctx , f .ClientSet , f .Namespace .Name , job .Name , nil , completions )
217
186
framework .ExpectNoError (err , "failed to ensure job completion in namespace: %s" , f .Namespace .Name )
0 commit comments