From 4debe449116852ff266f9c884457c35bebe408af Mon Sep 17 00:00:00 2001 From: Enrico Candino Date: Wed, 17 Jun 2026 12:13:01 +0200 Subject: [PATCH] fix possible flaky test --- tests/e2e/cluster_create_test.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/e2e/cluster_create_test.go b/tests/e2e/cluster_create_test.go index 3746a345..6856a7fd 100644 --- a/tests/e2e/cluster_create_test.go +++ b/tests/e2e/cluster_create_test.go @@ -103,15 +103,20 @@ var _ = When("creating an HCP mode cluster", Label(e2eTestLabel), Label(slowTest It("creates a populated token secret", func() { ctx := GinkgoT().Context() - var tokenSecret corev1.Secret + Eventually(func(g Gomega) { + var tokenSecret corev1.Secret - err := k8sClient.Get(ctx, client.ObjectKey{ - Name: k3kcluster.TokenSecretName(virtualCluster.Cluster.Name), - Namespace: virtualCluster.Cluster.Namespace, - }, &tokenSecret) + key := client.ObjectKey{ + Name: k3kcluster.TokenSecretName(virtualCluster.Cluster.Name), + Namespace: virtualCluster.Cluster.Namespace, + } - Expect(err).NotTo(HaveOccurred()) - Expect(tokenSecret.Data["token"]).NotTo(BeEmpty()) + g.Expect(k8sClient.Get(ctx, key, &tokenSecret)).To(Succeed()) + g.Expect(tokenSecret.Data["token"]).NotTo(BeEmpty()) + }). + WithTimeout(time.Minute). + WithPolling(time.Second). + Should(Succeed()) }) It("reconciles default/kubernetes Endpoints and EndpointSlice", func() {