From b5479029ff367859f619dc584612f7db793ad7be Mon Sep 17 00:00:00 2001 From: NiniOak Date: Thu, 16 May 2024 10:36:50 -0700 Subject: [PATCH 1/3] FLAKEY_TEST: Add retry to outbound request for ProxyLifecycleShutdownTest --- .../tests/connect/connect_proxy_lifecycle_test.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/acceptance/tests/connect/connect_proxy_lifecycle_test.go b/acceptance/tests/connect/connect_proxy_lifecycle_test.go index 95502c9869..22f7b5c53f 100644 --- a/acceptance/tests/connect/connect_proxy_lifecycle_test.go +++ b/acceptance/tests/connect/connect_proxy_lifecycle_test.go @@ -163,9 +163,17 @@ func TestConnectInject_ProxyLifecycleShutdown(t *testing.T) { case <-gracePeriodTimer.C: break gracePeriodLoop default: - output, err := k8s.RunKubectlAndGetOutputE(t, ctx.KubectlOptions(t), args...) - require.NoError(t, err) - require.True(t, !strings.Contains(output, "curl: (7) Failed to connect")) + retrier := &retry.Counter{Count: 3, Wait: 1 * time.Second} + retry.RunWith(retrier, t, func(r *retry.R) { + output, err := k8s.RunKubectlAndGetOutputE(r, ctx.KubectlOptions(t), args...) + if err != nil { + r.Errorf(err.Error()) + return + } + require.Condition(r, func() bool { + return !strings.Contains(output, "curl: (7) Failed to connect") + }, fmt.Sprintf("Error: %s", output)) + }) // If listener draining is disabled, ensure inbound // requests are accepted during grace period. From b7ecab42443ea54ba634aafe6a65caea815e63f9 Mon Sep 17 00:00:00 2001 From: NiniOak Date: Thu, 16 May 2024 16:13:10 -0700 Subject: [PATCH 2/3] increase retry count for TestAPIGateway_GatewayClassConfig test --- .../api-gateway/api_gateway_gatewayclassconfig_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/acceptance/tests/api-gateway/api_gateway_gatewayclassconfig_test.go b/acceptance/tests/api-gateway/api_gateway_gatewayclassconfig_test.go index 89ba07a1e7..eb820dca73 100644 --- a/acceptance/tests/api-gateway/api_gateway_gatewayclassconfig_test.go +++ b/acceptance/tests/api-gateway/api_gateway_gatewayclassconfig_test.go @@ -133,12 +133,14 @@ func TestAPIGateway_GatewayClassConfig(t *testing.T) { k8sClient.DeleteAllOf(context.Background(), &gwv1beta1.Gateway{}, client.InNamespace(namespace)) }) + + // Ensure it exists. logger.Log(t, "checking that gateway is synchronized to Consul") checkConsulExists(t, consulClient, api.APIGateway, gatewayName) // Scenario: Gateway deployment should match the default instances defined on the gateway class config - logger.Log(t, "checking that gateway instances match defined gateway class config") + // checking that gateway instances match defined gateway class config checkNumberOfInstances(t, k8sClient, consulClient, gateway.Name, gateway.Namespace, defaultInstances, gateway) // Scenario: Updating the GatewayClassConfig should not affect gateways that have already been created @@ -177,7 +179,7 @@ func scale(t *testing.T, client client.Client, name, namespace string, scaleTo * func checkNumberOfInstances(t *testing.T, k8client client.Client, consulClient *api.Client, name, namespace string, wantNumber *int32, gateway *gwv1beta1.Gateway) { t.Helper() - retryCheckWithWait(t, 30, 10*time.Second, func(r *retry.R) { + retryCheckWithWait(t, 40, 10*time.Second, func(r *retry.R) { logger.Log(t, "checking that gateway instances match defined gateway class config") logger.Log(t, fmt.Sprintf("want: %d", *wantNumber)) From 2fcccd23b78bf5684e09f0b1b92a4a4144670963 Mon Sep 17 00:00:00 2001 From: NiniOak Date: Thu, 16 May 2024 16:15:00 -0700 Subject: [PATCH 3/3] remove empty lines --- .../tests/api-gateway/api_gateway_gatewayclassconfig_test.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/acceptance/tests/api-gateway/api_gateway_gatewayclassconfig_test.go b/acceptance/tests/api-gateway/api_gateway_gatewayclassconfig_test.go index eb820dca73..14ef0e0035 100644 --- a/acceptance/tests/api-gateway/api_gateway_gatewayclassconfig_test.go +++ b/acceptance/tests/api-gateway/api_gateway_gatewayclassconfig_test.go @@ -133,8 +133,6 @@ func TestAPIGateway_GatewayClassConfig(t *testing.T) { k8sClient.DeleteAllOf(context.Background(), &gwv1beta1.Gateway{}, client.InNamespace(namespace)) }) - - // Ensure it exists. logger.Log(t, "checking that gateway is synchronized to Consul") checkConsulExists(t, consulClient, api.APIGateway, gatewayName)