Skip to content

Commit a6927f8

Browse files
authored
🌱 Adopt e2e labels usage (#11763)
* adopt e2e labels usage * fix unbound variable * revert script changes
1 parent d1e314e commit a6927f8

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export PATH := $(abspath $(TOOLS_BIN_DIR)):$(PATH)
7979
#
8080
GINKGO_FOCUS ?=
8181
GINKGO_SKIP ?=
82+
GINKGO_LABEL_FILTER ?=
8283
GINKGO_NODES ?= 1
8384
GINKGO_TIMEOUT ?= 2h
8485
GINKGO_POLL_PROGRESS_AFTER ?= 60m
@@ -973,7 +974,7 @@ test-test-extension-junit: $(SETUP_ENVTEST) $(GOTESTSUM) ## Run unit and integra
973974
.PHONY: test-e2e
974975
test-e2e: $(GINKGO) generate-e2e-templates ## Run the end-to-end tests
975976
$(GINKGO) -v --trace -poll-progress-after=$(GINKGO_POLL_PROGRESS_AFTER) \
976-
-poll-progress-interval=$(GINKGO_POLL_PROGRESS_INTERVAL) --tags=e2e --focus="$(GINKGO_FOCUS)" \
977+
-poll-progress-interval=$(GINKGO_POLL_PROGRESS_INTERVAL) --tags=e2e --focus="$(GINKGO_FOCUS)" --label-filter="$(GINKGO_LABEL_FILTER)" \
977978
$(_SKIP_ARGS) --nodes=$(GINKGO_NODES) --timeout=$(GINKGO_TIMEOUT) --no-color=$(GINKGO_NOCOLOR) \
978979
--output-dir="$(ARTIFACTS)" --junit-report="junit.e2e_suite.1.xml" $(GINKGO_ARGS) $(ROOT_DIR)/$(TEST_DIR)/e2e -- \
979980
-e2e.artifacts-folder="$(ARTIFACTS)" \

docs/book/src/developer/core/testing.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ For example to run [pull-cluster-api-e2e-main](https://github.com/kubernetes/tes
170170
just execute:
171171

172172
```bash
173-
GINKGO_FOCUS="\[PR-Blocking\]" ./scripts/ci-e2e.sh
173+
GINKGO_LABEL_FILTER="PR-Blocking" ./scripts/ci-e2e.sh
174174
```
175175

176176
### Test execution via make test-e2e
@@ -190,7 +190,7 @@ kind images). This can be done by executing the `./scripts/ci-e2e.sh` script.
190190
# Notes:
191191
# * You can cancel the script as soon as it starts the actual test execution via `make test-e2e`.
192192
# * If you want to run other tests (e.g. upgrade tests), make sure all required env variables are set (see the Prow Job config).
193-
GINKGO_FOCUS="\[PR-Blocking\]" ./scripts/ci-e2e.sh
193+
GINKGO_LABEL_FILTER="PR-Blocking" ./scripts/ci-e2e.sh
194194
```
195195

196196
Now, the tests can be run in an IDE. The following describes how this can be done in IntelliJ IDEA and VS Code. It should work
@@ -272,24 +272,24 @@ kustomize_substitutions:
272272
273273
### Running specific tests
274274
275-
To run a subset of tests, a combination of either one or both of `GINKGO_FOCUS` and `GINKGO_SKIP` env variables can be set.
275+
To run a subset of tests the `GINKGO_LABEL_FILTER` env variable can be set. See [Ginkgo Spec Labels v2](https://onsi.github.io/ginkgo/MIGRATING_TO_V2#spec-labels) for complete syntax documentation.
276+
276277
Each of these can be used to match tests, for example:
277-
- `[PR-Blocking]` => Sanity tests run before each PR merge
278-
- `[K8s-Upgrade]` => Tests which verify k8s component version upgrades on workload clusters
279-
- `[Conformance]` => Tests which run the k8s conformance suite on workload clusters
280-
- `[ClusterClass]` => Tests which use a ClusterClass to create a workload cluster
281-
- `When testing KCP.*` => Tests which start with `When testing KCP`
278+
- `PR-Blocking` => Sanity tests run before each PR merge
279+
- `K8s-Upgrade` => Tests which verify k8s component version upgrades on workload clusters
280+
- `Conformance` => Tests which run the k8s conformance suite on workload clusters
281+
- `ClusterClass` => Tests which use a ClusterClass to create a workload cluster
282+
- `/When testing KCP.*/` => Tests which start with `When testing KCP`
282283

283284
For example:
284-
` GINKGO_FOCUS="\\[PR-Blocking\\]" make test-e2e ` can be used to run the sanity E2E tests
285-
` GINKGO_SKIP="\\[K8s-Upgrade\\]" make test-e2e ` can be used to skip the upgrade E2E tests
285+
` GINKGO_LABEL_FILTER="PR-Blocking" make test-e2e ` can be used to run the sanity E2E tests
286+
` GINKGO_LABEL_FILTER="!K8s-Upgrade" make test-e2e ` can be used to skip the upgrade E2E tests
286287

287288
### Further customization
288289

289290
The following env variables can be set to customize the test execution:
290291

291-
- `GINKGO_FOCUS` to set ginkgo focus (default empty - all tests)
292-
- `GINKGO_SKIP` to set ginkgo skip (default empty - to allow running all tests)
292+
- `GINKGO_LABEL_FILTER` to set ginkgo label filter (default empty - all tests)
293293
- `GINKGO_NODES` to set the number of ginkgo parallel nodes (default to 1)
294294
- `E2E_CONF_FILE` to set the e2e test config file (default to ${REPO_ROOT}/test/e2e/config/docker.yaml)
295295
- `ARTIFACTS` to set the folder where test artifact will be stored (default to ${REPO_ROOT}/_artifacts)

test/infrastructure/inmemory/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ kubectl --kubeconfig=/tmp/kubeconfig --server=https://127.0.0.1:$CONTROL_PLANE_E
126126
### E2E tests
127127

128128
CAPIM could be used to run a subset of CAPI E2E tests, but as of today we maintain only a smoke E2E scale test
129-
(10 clusters, 1 CP and 3 workers each) that can be executed by setting `GINKGO_FOCUS="in-memory"`.
129+
(10 clusters, 1 CP and 3 workers each) that can be executed by setting `GINKGO_LABEL_FILTER="in-memory"`.
130130

131131
See [Running the end-to-end tests locally](https://cluster-api.sigs.k8s.io/developer/testing#running-the-end-to-end-tests-locally) for more details.
132132

0 commit comments

Comments
 (0)