Skip to content

Commit 8e73871

Browse files
committed
e2e: serialize TestGatewayAPI to avoid webhook race condition
TestGatewayAPI creates a test ServiceMeshControlPlane (SMCP) resource, which triggers the creation of a mutating webhook for all pods in the cluster. This introduces a race condition where any pod creation request between the webhook's creation and the SMCP pod becoming ready can fail with: failed calling webhook "sidecar-injector.istio.io": failed to call webhook: no endpoints available for service "istiod-openshift-gateway" Serializing the test ensures it runs in isolation with other tests, preventing any impact of the mutating webhook on pod creation in the cluster. Additionally, the timeout for the e2e tests has been increased to 1.5 hours since TestGatewayAPI adds ~10 minutes to the total execution time. Previously, tests ran for ~50 minutes, which was close to the 1-hour limit.
1 parent 22ca3e4 commit 8e73871

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ release-local:
5353

5454
.PHONY: test-e2e
5555
test-e2e: generate
56-
CGO_ENABLED=1 $(GO) test -timeout 1h -count 1 -v -tags e2e -run "$(TEST)" ./test/e2e
56+
CGO_ENABLED=1 $(GO) test -timeout 1.5h -count 1 -v -tags e2e -run "$(TEST)" ./test/e2e
5757

5858
.PHONY: test-e2e-list
5959
test-e2e-list: generate

test/e2e/all_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ func TestAll(t *testing.T) {
8383
t.Run("TestSetRouteResponseHeaders", TestSetRouteResponseHeaders)
8484
t.Run("TestReconcileInternalService", TestReconcileInternalService)
8585
t.Run("TestConnectTimeout", TestConnectTimeout)
86-
t.Run("TestGatewayAPI", TestGatewayAPI)
8786
t.Run("TestAWSLBSubnets", TestAWSLBSubnets)
8887
t.Run("TestUnmanagedAWSLBSubnets", TestUnmanagedAWSLBSubnets)
8988
t.Run("TestAWSEIPAllocationsForNLB", TestAWSEIPAllocationsForNLB)
@@ -126,5 +125,16 @@ func TestAll(t *testing.T) {
126125
t.Run("TestRouteHardStopAfterEnableOnIngressControllerHasPriorityOverIngressConfig", TestRouteHardStopAfterEnableOnIngressControllerHasPriorityOverIngressConfig)
127126
t.Run("TestHostNetworkPortBinding", TestHostNetworkPortBinding)
128127
t.Run("TestDashboardCreation", TestDashboardCreation)
128+
// TestGatewayAPI creates a test ServiceMeshControlPlane (SMCP) resource,
129+
// which triggers the creation of a mutating webhook for all pods in the cluster.
130+
// This introduces a race condition where any pod creation request between
131+
// the webhook's creation and the SMCP pod becoming ready can fail with:
132+
//
133+
// failed calling webhook "sidecar-injector.istio.io": failed to call webhook:
134+
// no endpoints available for service "istiod-openshift-gateway"
135+
//
136+
// Serializing the test ensures it runs in isolation with other tests,
137+
// preventing any impact of the mutating webhook on pod creation in the cluster
138+
t.Run("TestGatewayAPI", TestGatewayAPI)
129139
})
130140
}

test/e2e/gateway_api_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ var defaultRoutename = ""
5959
// feature gate is still in effect, preface the test names with "TestGatewayAPI"
6060
// so that they run via the openshift/release test configuration.
6161
func TestGatewayAPI(t *testing.T) {
62-
t.Parallel()
63-
6462
// Skip if feature is not enabled
6563
if gatewayAPIEnabled, err := isFeatureGateEnabled(features.FeatureGateGatewayAPI); err != nil {
6664
t.Fatalf("error checking feature gate enabled status: %v", err)

0 commit comments

Comments
 (0)