Skip to content

Commit 65cd689

Browse files
authored
add failing job with retry test (#235)
1 parent b81f818 commit 65cd689

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/e2e/appwrapper_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,23 @@ var _ = Describe("AppWrapper E2E Test", func() {
293293
Eventually(AppWrapperPhase(ctx, aw), 90*time.Second).Should(Equal(workloadv1beta2.AppWrapperFailed))
294294
})
295295

296+
It("Failed Jobs will be retried up to retryLimit", func() {
297+
aw := toAppWrapper(failingBatchjob(500))
298+
if aw.Annotations == nil {
299+
aw.Annotations = make(map[string]string)
300+
}
301+
aw.Annotations[workloadv1beta2.FailureGracePeriodDurationAnnotation] = "0s"
302+
aw.Annotations[workloadv1beta2.RetryLimitAnnotation] = "2"
303+
aw.Annotations[workloadv1beta2.RetryPausePeriodDurationAnnotation] = "5s"
304+
Expect(getClient(ctx).Create(ctx, aw)).To(Succeed())
305+
appwrappers = append(appwrappers, aw)
306+
Expect(waitAWPodsReady(ctx, aw)).Should(Succeed())
307+
Eventually(AppWrapperPhase(ctx, aw), 90*time.Second).Should(Equal(workloadv1beta2.AppWrapperResetting))
308+
Eventually(AppWrapperPhase(ctx, aw), 180*time.Second).Should(Equal(workloadv1beta2.AppWrapperFailed))
309+
aw = getAppWrapper(ctx, types.NamespacedName{Name: aw.Name, Namespace: aw.Namespace})
310+
Expect(aw.Status.Retries).Should(Equal(int32(2)))
311+
})
312+
296313
It("Deleting a Running Component yields a failed AppWrapper", func() {
297314
aw := createAppWrapper(ctx, pytorchjob(2, 500))
298315
appwrappers = append(appwrappers, aw)

0 commit comments

Comments
 (0)