diff --git a/test/integration/test_gateway.go b/test/integration/test_gateway.go index 53cd4b0ea..50bd50a63 100644 --- a/test/integration/test_gateway.go +++ b/test/integration/test_gateway.go @@ -312,31 +312,31 @@ func TestGatewayMultiple(t *testing.T) { httpRouteOne := createHTTPRoute(gatewayOne, service, pathOne) require.EventuallyWithT(t, func(c *assert.CollectT) { - var err error - httpRouteOne, err = gatewayV1Client.HTTPRoutes(namespace.Name).Create(GetCtx(), httpRouteOne, metav1.CreateOptions{}) + result, err := gatewayV1Client.HTTPRoutes(namespace.Name).Create(GetCtx(), httpRouteOne, metav1.CreateOptions{}) if err != nil { t.Logf("failed to deploy httproute: %v", err) c.Errorf("failed to deploy httproute: %v", err) + return } + cleaner.Add(result) }, 30*time.Second, time.Second, ) - cleaner.Add(httpRouteOne) const pathTwo = "/path-test-two" httpRouteTwo := createHTTPRoute(gatewayTwo, service, pathTwo) require.EventuallyWithT(t, func(c *assert.CollectT) { - var err error - httpRouteTwo, err = gatewayV1Client.HTTPRoutes(namespace.Name).Create(GetCtx(), httpRouteTwo, metav1.CreateOptions{}) + result, err := gatewayV1Client.HTTPRoutes(namespace.Name).Create(GetCtx(), httpRouteTwo, metav1.CreateOptions{}) if err != nil { t.Logf("failed to deploy httproute: %v", err) c.Errorf("failed to deploy httproute: %v", err) + return } + cleaner.Add(result) }, 30*time.Second, time.Second, ) - cleaner.Add(httpRouteTwo) t.Log("verifying connectivity to the HTTPRoute") diff --git a/test/integration/test_httproute.go b/test/integration/test_httproute.go index b2c194f89..6dfb6b614 100644 --- a/test/integration/test_httproute.go +++ b/test/integration/test_httproute.go @@ -159,15 +159,16 @@ func TestHTTPRouteV1Beta1(t *testing.T) { t.Logf("creating httproute %s/%s to access deployment %s via kong", httpRoute.Namespace, httpRoute.Name, deployment.Name) require.EventuallyWithT(t, func(c *assert.CollectT) { - httpRoute, err = GetClients().GatewayClient.GatewayV1().HTTPRoutes(namespace.Name).Create(GetCtx(), httpRoute, metav1.CreateOptions{}) + result, 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) + return } + cleaner.Add(result) }, testutils.DefaultIngressWait, testutils.WaitIngressTick, ) - cleaner.Add(httpRoute) t.Log("verifying connectivity to the HTTPRoute") const (