diff --git a/pkg/internal/integration/service_test.go b/pkg/internal/integration/service_test.go index 275648b..6471530 100644 --- a/pkg/internal/integration/service_test.go +++ b/pkg/internal/integration/service_test.go @@ -735,6 +735,11 @@ func (s *IntegrationTestSuite) TestServiceEndToEndDualProtocol() { s.Require().Len(svc.Status.LoadBalancer.Ingress, 2) addr := svc.Status.LoadBalancer.Ingress[0].IP + // We have to wait a few seconds until the configured health monitor reports the services as up. + // Sleeping 9 seconds allows for at least 3 successful up probes, + // which is one more than required. + time.Sleep(3 * 3 * time.Second) + // Create custom resolver pointing to the DNS service resolver := &net.Resolver{ PreferGo: true, @@ -959,6 +964,9 @@ func (s *IntegrationTestSuite) TestServiceTrafficPolicyLocal() { // Now expect to see an IP address from the node's private network assertPrefix(addr, &local_policy_prefix) + // Allow the load balancer to stabilize after switching traffic policy. + // Without this, we may see connection resets during rapid assertions. + time.Sleep(5 * time.Second) assertFastResponses(addr, &local_policy_prefix) // Go back to the Cluster policy @@ -975,6 +983,9 @@ func (s *IntegrationTestSuite) TestServiceTrafficPolicyLocal() { s.Require().NotNil(service) assertPrefix(addr, &cluster_policy_prefix) + // Allow the load balancer to stabilize after switching traffic policy. + // Without this, we may see connection resets during rapid assertions. + time.Sleep(5 * time.Second) assertFastResponses(addr, &cluster_policy_prefix) }