From 2ebefd207eabbf38f3592365cc2d30bb7882644f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Ma=C5=82ek?= Date: Fri, 15 Mar 2024 14:31:46 +0100 Subject: [PATCH] tests: fix flaky HTTPRoute creation (#13) --- test/integration/test_httproute.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/integration/test_httproute.go b/test/integration/test_httproute.go index 72b323ec6..b2c194f89 100644 --- a/test/integration/test_httproute.go +++ b/test/integration/test_httproute.go @@ -7,6 +7,7 @@ import ( "github.com/google/uuid" "github.com/kong/kubernetes-testing-framework/pkg/utils/kubernetes/generators" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -156,9 +157,16 @@ func TestHTTPRouteV1Beta1(t *testing.T) { }, } t.Logf("creating httproute %s/%s to access deployment %s via kong", httpRoute.Namespace, httpRoute.Name, deployment.Name) - httpRoute, err = GetClients().GatewayClient.GatewayV1().HTTPRoutes(namespace.Name). - Create(GetCtx(), httpRoute, metav1.CreateOptions{}) - require.NoError(t, err) + require.EventuallyWithT(t, + func(c *assert.CollectT) { + httpRoute, err = GetClients().GatewayClient.GatewayV1().HTTPRoutes(namespace.Name).Create(GetCtx(), httpRoute, metav1.CreateOptions{}) + if err != nil { + t.Logf("failed to deploy httproute: %v", err) + c.Errorf("failed to deploy httproute: %v", err) + } + }, + testutils.DefaultIngressWait, testutils.WaitIngressTick, + ) cleaner.Add(httpRoute) t.Log("verifying connectivity to the HTTPRoute")