Skip to content

Commit 5f293de

Browse files
committed
iterate
1 parent e2f14d1 commit 5f293de

File tree

4 files changed

+15
-21
lines changed

4 files changed

+15
-21
lines changed

Makefile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export PATH := $(abspath $(TOOLS_BIN_DIR)):$(PATH)
7878
# Ginkgo configuration.
7979
#
8080
GINKGO_LABEL_FILTER ?=
81-
GINKGO_SKIP ?=
8281
GINKGO_NODES ?= 1
8382
GINKGO_TIMEOUT ?= 2h
8483
GINKGO_POLL_PROGRESS_AFTER ?= 60m
@@ -88,11 +87,6 @@ SKIP_RESOURCE_CLEANUP ?= false
8887
USE_EXISTING_CLUSTER ?= false
8988
GINKGO_NOCOLOR ?= false
9089

91-
# to set multiple ginkgo skip flags, if any
92-
ifneq ($(strip $(GINKGO_SKIP)),)
93-
_SKIP_ARGS := $(foreach arg,$(strip $(GINKGO_SKIP)),-skip="$(arg)")
94-
endif
95-
9690
# Helper function to get dependency version from go.mod
9791
get_go_version = $(shell go list -m $1 | awk '{print $$2}')
9892

@@ -979,7 +973,7 @@ test-test-extension-junit: $(SETUP_ENVTEST) $(GOTESTSUM) ## Run unit and integra
979973
test-e2e: $(GINKGO) generate-e2e-templates ## Run the end-to-end tests
980974
$(GINKGO) -v --trace -poll-progress-after=$(GINKGO_POLL_PROGRESS_AFTER) \
981975
-poll-progress-interval=$(GINKGO_POLL_PROGRESS_INTERVAL) --tags=e2e --label-filter="$(GINKGO_LABEL_FILTER)" \
982-
$(_SKIP_ARGS) --nodes=$(GINKGO_NODES) --timeout=$(GINKGO_TIMEOUT) --no-color=$(GINKGO_NOCOLOR) \
976+
--nodes=$(GINKGO_NODES) --timeout=$(GINKGO_TIMEOUT) --no-color=$(GINKGO_NOCOLOR) \
983977
--output-dir="$(ARTIFACTS)" --junit-report="junit.e2e_suite.1.xml" $(GINKGO_ARGS) $(ROOT_DIR)/$(TEST_DIR)/e2e -- \
984978
-e2e.artifacts-folder="$(ARTIFACTS)" \
985979
-e2e.config="$(E2E_CONF_FILE)" \

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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:
284285
` GINKGO_LABEL_FILTER="PR-Blocking" make test-e2e ` can be used to run the sanity E2E tests
285-
` GINKGO_LABEL_FILTER="K8s-Upgrade" make test-e2e ` can be used to skip the upgrade 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

291292
- `GINKGO_LABEL_FILTER` to set ginkgo label filter (default empty - all tests)
292-
- `GINKGO_SKIP` to set ginkgo skip (default empty - to allow running 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)

scripts/ci-e2e-lib.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ capi:buildDockerImages () {
3636

3737
# k8s::prepareKindestImagesVariables defaults the environment variables KUBERNETES_VERSION_MANAGEMENT, KUBERNETES_VERSION,
3838
# KUBERNETES_VERSION_UPGRADE_TO, KUBERNETES_VERSION_UPGRADE_FROM and KUBERNETES_VERSION_LATEST_CI
39-
# depending on what is set in GINKGO_FOCUS.
39+
# depending on what is set in GINKGO_LABEL_FILTER.
4040
# Note: We do this to ensure that the kindest/node image gets built if it does
4141
# not already exist, e.g. for pre-releases, but only if necessary.
4242
k8s::prepareKindestImagesVariables() {
@@ -46,15 +46,15 @@ k8s::prepareKindestImagesVariables() {
4646
echo "Defaulting KUBERNETES_VERSION_MANAGEMENT to ${KUBERNETES_VERSION_MANAGEMENT} to trigger image build (because env var is not set)"
4747
fi
4848

49-
if [[ ${GINKGO_FOCUS:-} == *"K8s-Install-ci-latest"* ]]; then
49+
if [[ ${GINKGO_LABEL_FILTER:-} == *"K8s-Install-ci-latest"* ]]; then
5050
# If the test focuses on [K8s-Install-ci-latest], only default KUBERNETES_VERSION_LATEST_CI
5151
# to the value in the e2e config and only if it is not set.
5252
# Note: We do this because we want to specify KUBERNETES_VERSION_LATEST_CI *only* in the e2e config.
5353
if [[ -z "${KUBERNETES_VERSION_LATEST_CI:-}" ]]; then
5454
KUBERNETES_VERSION_LATEST_CI=$(grep KUBERNETES_VERSION_LATEST_CI: < "$E2E_CONF_FILE" | awk -F'"' '{ print $2}')
5555
echo "Defaulting KUBERNETES_VERSION_LATEST_CI to ${KUBERNETES_VERSION_LATEST_CI} to trigger image build (because env var is not set)"
5656
fi
57-
elif [[ ${GINKGO_FOCUS:-} != *"K8s-Upgrade"* ]]; then
57+
elif [[ ${GINKGO_LABEL_FILTER:-} != *"K8s-Upgrade"* ]]; then
5858
# In any other case which is not [K8s-Upgrade], default KUBERNETES_VERSION if it is not set to make sure
5959
# the corresponding kindest/node image exists.
6060
if [[ -z "${KUBERNETES_VERSION:-}" ]]; then
@@ -65,7 +65,7 @@ k8s::prepareKindestImagesVariables() {
6565

6666
# Tests not focusing on anything and skipping [Conformance] run a clusterctl upgrade test
6767
# on the latest kubernetes version as management cluster.
68-
if [[ ${GINKGO_FOCUS:-} == "" ]] && [[ ${GINKGO_SKIP} == *"Conformance"* ]]; then
68+
if [[ ${GINKGO_LABEL_FILTER:-} == "" ]] && [[ ${GINKGO_LABEL_FILTER} == *"!Conformance"* ]]; then
6969
# Note: We do this because we want to specify KUBERNETES_VERSION_LATEST_CI *only* in the e2e config.
7070
if [[ -z "${KUBERNETES_VERSION_LATEST_CI:-}" ]]; then
7171
KUBERNETES_VERSION_LATEST_CI=$(grep KUBERNETES_VERSION_LATEST_CI: < "$E2E_CONF_FILE" | awk -F'"' '{ print $2}')
@@ -76,7 +76,7 @@ k8s::prepareKindestImagesVariables() {
7676
# Tests not focusing on [PR-Blocking], [K8s-Install] or [K8s-Install-ci-latest],
7777
# also run upgrade tests so default KUBERNETES_VERSION_UPGRADE_TO and KUBERNETES_VERSION_UPGRADE_FROM
7878
# to the value in the e2e config if they are not set.
79-
if [[ ${GINKGO_FOCUS:-} != *"PR-Blocking"* ]] && [[ ${GINKGO_FOCUS:-} != *"K8s-Install"* ]]; then
79+
if [[ ${GINKGO_LABEL_FILTER:-} != *"PR-Blocking"* ]] && [[ ${GINKGO_LABEL_FILTER:-} != *"K8s-Install"* ]]; then
8080
if [[ -z "${KUBERNETES_VERSION_UPGRADE_TO:-}" ]]; then
8181
KUBERNETES_VERSION_UPGRADE_TO=$(grep KUBERNETES_VERSION_UPGRADE_TO: < "$E2E_CONF_FILE" | awk -F'"' '{ print $2}')
8282
echo "Defaulting KUBERNETES_VERSION_UPGRADE_TO to ${KUBERNETES_VERSION_UPGRADE_TO} to trigger image build (because env var is not set)"

test/infrastructure/inmemory/README.md

Lines changed: 1 addition & 1 deletion
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)