Skip to content

Commit 602be42

Browse files
committed
Fix flaky e2e test
Signed-off-by: Shingo Omura <[email protected]>
1 parent 43bcea2 commit 602be42

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

test/e2e/sparkapplication_test.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -439,21 +439,27 @@ var _ = Describe("Example SparkApplication", func() {
439439
}).WithTimeout(5 * time.Second).Should(Succeed())
440440

441441
By("Suspending Spark Application")
442-
Expect(k8sClient.Get(ctx, key, app)).To(Succeed())
443-
app.Spec.Suspend = ptr.To(true)
444-
Expect(k8sClient.Update(ctx, app)).To(Succeed())
442+
Eventually(func(g Gomega) {
443+
app := &v1beta2.SparkApplication{}
444+
Expect(k8sClient.Get(ctx, key, app)).To(Succeed())
445+
app.Spec.Suspend = ptr.To(true)
446+
Expect(k8sClient.Update(ctx, app)).To(Succeed())
447+
}).WithTimeout(5 * time.Second).Should(Succeed())
445448

446449
By("Waiting for SparkApplication to Suspended")
447450
Eventually(func(g Gomega) {
448451
app := &v1beta2.SparkApplication{}
449452
g.Expect(k8sClient.Get(ctx, key, app)).To(Succeed())
450453
g.Expect(app.Status.AppState.State).To(Equal(v1beta2.ApplicationStateSuspended))
451-
}).WithTimeout(3 * time.Minute).Should(Succeed())
454+
}).WithTimeout(1 * time.Minute).Should(Succeed())
452455

453456
By("Resuming for SparkApplication")
454-
Expect(k8sClient.Get(ctx, key, app)).To(Succeed())
455-
app.Spec.Suspend = ptr.To(false)
456-
Expect(k8sClient.Update(ctx, app)).To(Succeed())
457+
Eventually(func(g Gomega) {
458+
app := &v1beta2.SparkApplication{}
459+
Expect(k8sClient.Get(ctx, key, app)).To(Succeed())
460+
app.Spec.Suspend = ptr.To(false)
461+
Expect(k8sClient.Update(ctx, app)).To(Succeed())
462+
}).WithTimeout(5 * time.Second).Should(Succeed())
457463

458464
By("Waiting for SparkApplication to Running")
459465
Eventually(func(g Gomega) {

0 commit comments

Comments
 (0)