Skip to content

Commit

Permalink
Improve error checks around FetchIngressIP
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Nola <[email protected]>
  • Loading branch information
dereknola committed Feb 7, 2025
1 parent fe34432 commit e89c8c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions tests/e2e/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
10 changes: 7 additions & 3 deletions tests/e2e/wasm/wasm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e89c8c0

Please sign in to comment.