From e89c8c024b09ca4a383d9d44046281984a366d51 Mon Sep 17 00:00:00 2001 From: Derek Nola Date: Fri, 7 Feb 2025 11:19:02 -0800 Subject: [PATCH] Improve error checks around FetchIngressIP Signed-off-by: Derek Nola --- tests/e2e/testutils.go | 3 +++ tests/e2e/wasm/wasm_test.go | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/e2e/testutils.go b/tests/e2e/testutils.go index 0d471666cb68..4b01e493bb9f 100644 --- a/tests/e2e/testutils.go +++ b/tests/e2e/testutils.go @@ -350,6 +350,9 @@ func FetchIngressIP(kubeconfig string) ([]string, error) { } ingressIP := strings.Trim(res, " ") ingressIPs := strings.Split(ingressIP, " ") + if len(ingressIPs) == 0 { + return nil, errors.New("no ingress IP found") + } return ingressIPs, nil } diff --git a/tests/e2e/wasm/wasm_test.go b/tests/e2e/wasm/wasm_test.go index 60c42625e004..d6869cbb1a37 100644 --- a/tests/e2e/wasm/wasm_test.go +++ b/tests/e2e/wasm/wasm_test.go @@ -97,9 +97,13 @@ var _ = Describe("Verify K3s can run Wasm workloads", Ordered, func() { }) It("Interact with Wasm applications", func() { - ingressIPs, err := e2e.FetchIngressIP(tc.KubeConfigFile) - Expect(err).NotTo(HaveOccurred()) - Expect(ingressIPs).To(HaveLen(1)) + var ingressIPs []string + var err error + Eventually(func(g Gomega) { + ingressIPs, err = e2e.FetchIngressIP(tc.KubeConfigFile) + g.Expect(err).NotTo(HaveOccurred()) + g.Expect(ingressIPs).To(HaveLen(1)) + }, "120s", "5s").Should(Succeed()) endpoints := []string{"slight/hello", "spin/go-hello", "spin/hello"} for _, endpoint := range endpoints {