Skip to content

Commit

Permalink
tests: fix flaky HTTPRoute creation (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek authored Mar 20, 2024
1 parent e761c0c commit 31114aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions test/integration/test_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
5 changes: 3 additions & 2 deletions test/integration/test_httproute.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 31114aa

Please sign in to comment.