Skip to content

Commit 576230b

Browse files
committed
test: ensure TrainJob does not exist after rejected request using Consistently
Signed-off-by: DIGVIJAY <144053736+digvijay-y@users.noreply.github.com>
1 parent 21dcb1a commit 576230b

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

test/integration/controller/statusserver_test.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -431,12 +431,14 @@ var _ = ginkgo.Describe("StatusServer", ginkgo.Ordered, func() {
431431
// Confirm the TrainJob truly does not exist — the rejected request must
432432
// not have created it as a side-effect.
433433
ginkgo.By("Verifying the TrainJob does not exist in the cluster")
434-
notFound := &trainer.TrainJob{}
435-
err := k8sClient.Get(ctx, types.NamespacedName{
436-
Name: jobName,
437-
Namespace: ns.Name,
438-
}, notFound)
439-
gomega.Expect(apierrors.IsNotFound(err)).To(gomega.BeTrue(),
440-
"the TrainJob should not exist; a rejected request must not create it")
434+
gomega.Consistently(func(g gomega.Gomega) {
435+
notFound := &trainer.TrainJob{}
436+
err := k8sClient.Get(ctx, types.NamespacedName{
437+
Name: jobName,
438+
Namespace: ns.Name,
439+
}, notFound)
440+
g.Expect(apierrors.IsNotFound(err)).To(gomega.BeTrue(),
441+
"the TrainJob should not exist; a rejected request must not create it")
442+
}, 2*time.Second, 500*time.Millisecond).Should(gomega.Succeed())
441443
})
442444
})

0 commit comments

Comments
 (0)