Skip to content

Commit dd0d4c8

Browse files
dtfranzclaude
andcommitted
Concurrent Test Execution
Takes advantage of changes made to isolate test runs to execute as many tests in parallel as possible. For tests that must be run serially, the @serial tag has been added to the beginning of relevant feature file(s). Signed-off-by: Daniel Franz <dfranz@redhat.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 6e39708 commit dd0d4c8

6 files changed

Lines changed: 53 additions & 1 deletion

File tree

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,19 @@ E2E_TIMEOUT ?= 20m
258258
GODOG_ARGS ?=
259259
.PHONY: e2e
260260
e2e: #EXHELP Run the e2e tests.
261-
go test -count=1 -v ./test/e2e/features_test.go -timeout=$(E2E_TIMEOUT) $(if $(GODOG_ARGS),-args $(GODOG_ARGS))
261+
ifeq ($(strip $(GODOG_ARGS)),)
262+
set +e; \
263+
go test -count=1 -v ./test/e2e/features_test.go -timeout=$(E2E_TIMEOUT) -args --godog.tags="~@Serial" --godog.concurrency=100; \
264+
parallelExitCode=$$?; \
265+
go test -count=1 -v ./test/e2e/features_test.go -timeout=$(E2E_TIMEOUT) -args --godog.tags="@Serial" --godog.concurrency=1; \
266+
serialExitCode=$$?; \
267+
if [ $$parallelExitCode -ne 0 ] || [ $$serialExitCode -ne 0 ]; then \
268+
echo "e2e tests failed: parallel=$$parallelExitCode serial=$$serialExitCode"; \
269+
exit 1; \
270+
fi
271+
else
272+
go test -count=1 -v ./test/e2e/features_test.go -timeout=$(E2E_TIMEOUT) -args $(GODOG_ARGS)
273+
endif
262274

263275
export CLUSTER_REGISTRY_HOST := docker-registry.operator-controller-e2e.svc:5000
264276
.PHONY: extension-developer-e2e

test/e2e/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ Use these variables in YAML templates:
207207

208208
### 5. Feature Tags
209209

210+
Tags can be used for different purposes in the test suite:
211+
212+
#### Feature Gate Tags
213+
210214
Use tags to conditionally run scenarios based on feature gates:
211215

212216
```gherkin
@@ -216,6 +220,28 @@ Scenario: Install operator having webhooks
216220

217221
Scenarios are skipped if the feature gate is not enabled on the deployed controller.
218222

223+
#### Serial Execution Tag
224+
225+
By default, scenarios run concurrently (up to 100 parallel scenarios). However, some tests must run serially, typically because they:
226+
- Modify shared cluster resources (e.g., cluster-wide TLS configuration)
227+
- Have resource constraints that prevent parallel execution
228+
- Require exclusive access to a resource
229+
230+
To mark a test for serial execution, add the `@Serial` tag:
231+
232+
```gherkin
233+
@Serial
234+
Feature: TLS profile enforcement on metrics endpoints
235+
236+
Scenario: Test TLS configuration
237+
Given the "catalogd" deployment is configured with custom TLS settings
238+
...
239+
```
240+
241+
The test runner automatically separates scenarios:
242+
- Scenarios **without** `@Serial` run concurrently in the first test phase
243+
- Scenarios **with** `@Serial` run sequentially in a separate serial test phase
244+
219245
## Running Tests
220246

221247
### Run All Tests
@@ -230,6 +256,15 @@ or
230256
make test-experimental-e2e
231257
```
232258

259+
Custom godog arguments can be modified by setting the following:
260+
```bash
261+
GODOG_ARGS=--godog.tags=@WebhookProviderCertManager make test-experimental-e2e
262+
```
263+
264+
Note that when this is done the `make` target will no longer automatically split the test run into parallel and serial runs, and test execution time may increase. If you wish to add concurrency back into the arguments, it is recommended to also disable the `@Serial` tests:
265+
```bash
266+
GODOG_ARGS="--godog.tags=~@Serial --godog.concurrency=100" make test-experimental-e2e
267+
```
233268

234269
### Run Specific Feature
235270

test/e2e/features/ha.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@Serial
12
Feature: HA failover for catalogd
23

34
When catalogd is deployed with multiple replicas, the remaining pods must

test/e2e/features/proxy.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@Serial
12
Feature: HTTPS proxy support for outbound catalog requests
23

34
OLM's operator-controller fetches catalog data from catalogd over HTTPS.

test/e2e/features/revision.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,7 @@ Feature: Install ClusterObjectSet
672672
And resource "deployment/test-deployment" is eventually not found
673673

674674
@ProgressDeadline
675+
@Serial
675676
Scenario: COS recovers from ProgressDeadlineExceeded to Succeeded when probes pass
676677
Given min value for ClusterObjectSet .spec.progressDeadlineMinutes is set to 1
677678
And ServiceAccount "olm-sa" with needed permissions is available in test namespace
@@ -721,6 +722,7 @@ Feature: Install ClusterObjectSet
721722
containers:
722723
- name: delayed-ready
723724
image: busybox:1.36
725+
imagePullPolicy: IfNotPresent
724726
command: ["sleep", "1000"]
725727
readinessProbe:
726728
exec:

test/e2e/features/tls.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@Serial
12
Feature: TLS profile enforcement on metrics endpoints
23

34
Background:

0 commit comments

Comments
 (0)