From 17a76cc0e2f57b2c7616b3bf56db22a95b1cf519 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 27 Mar 2023 14:53:19 +0800 Subject: [PATCH] Feat: fix flacky test (#5742) Signed-off-by: Somefive (cherry picked from commit ca4636030effcc3174ac7987dae261942b58c516) Co-authored-by: Somefive --- test/e2e-multicluster-test/multicluster_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/e2e-multicluster-test/multicluster_test.go b/test/e2e-multicluster-test/multicluster_test.go index 07c926271..66ec623aa 100644 --- a/test/e2e-multicluster-test/multicluster_test.go +++ b/test/e2e-multicluster-test/multicluster_test.go @@ -711,7 +711,9 @@ var _ = Describe("Test multicluster scenario", func() { app := &v1beta1.Application{} Expect(yaml.Unmarshal(bs, app)).Should(Succeed()) app.SetNamespace(testNamespace) - Expect(k8sClient.Create(hubCtx, app)).Should(Succeed()) + Eventually(func(g Gomega) { // informer may have latency for the added definition + g.Expect(k8sClient.Create(hubCtx, app)).Should(Succeed()) + }).WithTimeout(10 * time.Second).WithPolling(2 * time.Second).Should(Succeed()) key := client.ObjectKeyFromObject(app) Eventually(func(g Gomega) { g.Expect(k8sClient.Get(hubCtx, key, app)).Should(Succeed())