Skip to content

Commit 6cfd86c

Browse files
authored
Allow E2E to skip multiple tests (operator-framework#2892)
Problem: There are instances where a user may wish to skip multiple e2e tests. Solution: Allow users to specify multple tests to skip in the e2e suite by setting multiple test names separated by the semicolon (;) symbol.` Signed-off-by: Alexander Greene <[email protected]> Signed-off-by: Alexander Greene <[email protected]>
1 parent 1f8ccd1 commit 6cfd86c

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ IMAGE_REPO := quay.io/operator-framework/olm
2121
IMAGE_TAG ?= "dev"
2222
SPECIFIC_UNIT_TEST := $(if $(TEST),-run $(TEST),)
2323
LOCAL_NAMESPACE := "olm"
24+
SPLIT_SKIP=$(shell ./scripts/split_skips_string.sh "$(SKIP)")
2425
export GO111MODULE=on
2526
YQ_INTERNAL := go run $(MOD_FLAGS) ./vendor/github.com/mikefarah/yq/v3/
2627
KUBEBUILDER_ASSETS := $(or $(or $(KUBEBUILDER_ASSETS),$(dir $(shell command -v kubebuilder))),/usr/local/kubebuilder/bin)
@@ -136,7 +137,9 @@ E2E_TEST_NUM_CHUNKS ?= 4
136137
ifneq (all,$(E2E_TEST_CHUNK))
137138
TEST := $(shell go run ./test/e2e/split/... -chunks $(E2E_TEST_NUM_CHUNKS) -print-chunk $(E2E_TEST_CHUNK) ./test/e2e)
138139
endif
139-
E2E_OPTS ?= $(if $(E2E_SEED),-seed '$(E2E_SEED)') $(if $(SKIP), -skip '$(SKIP)') $(if $(TEST),-focus '$(TEST)') $(if $(ARTIFACT_DIR), -output-dir $(ARTIFACT_DIR) -junit-report junit_e2e.xml) -flake-attempts $(E2E_FLAKE_ATTEMPTS) -nodes $(E2E_NODES) -timeout $(E2E_TIMEOUT) -v -randomize-suites -race -trace -progress
140+
141+
142+
E2E_OPTS ?= $(if $(E2E_SEED),-seed '$(E2E_SEED)') $(if $(SKIP), $(SPLIT_SKIP)) $(if $(TEST),-focus '$(TEST)') $(if $(ARTIFACT_DIR), -output-dir $(ARTIFACT_DIR) -junit-report junit_e2e.xml) -flake-attempts $(E2E_FLAKE_ATTEMPTS) -nodes $(E2E_NODES) -timeout $(E2E_TIMEOUT) -v -randomize-suites -race -trace -progress
140143
E2E_INSTALL_NS ?= operator-lifecycle-manager
141144
E2E_CATALOG_NS ?= $(E2E_INSTALL_NS)
142145
E2E_TEST_NS ?= operators

scripts/split_skips_string.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Set the delimiter
2+
IFS=';'
3+
4+
# Read the split words into an array
5+
read -ra skipped_tests <<< "$1"
6+
7+
# Construct the skip arguments for the e2e test
8+
output=""
9+
for test in "${skipped_tests[@]}";
10+
do
11+
output="$output -skip '$test'"
12+
done
13+
14+
echo $output

0 commit comments

Comments
 (0)