From dfa57d215d362c64b37eb5ee14ae007e85f8ae00 Mon Sep 17 00:00:00 2001 From: Baiju Muthukadan Date: Tue, 3 Oct 2023 12:37:40 +0530 Subject: [PATCH 1/2] Support regexp filter for tests that needs to run (#802) * Support regexp filter for tests that needs to run Signed-off-by: Baiju Muthukadan * Add docs about the variable Signed-off-by: Baiju Muthukadan --------- Signed-off-by: Baiju Muthukadan Co-authored-by: Alexey Kazakov Co-authored-by: Rajiv Senthilnathan --- README.adoc | 2 ++ make/test.mk | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index e8a536ffe..7cbc850fc 100644 --- a/README.adoc +++ b/README.adoc @@ -70,6 +70,8 @@ NOTE: you can override the default namespace names where the end-to-end tests ar NOTE: you can disable SSL/TLS certificate verification in tests setting the `DISABLE_KUBE_CLIENT_TLS_VERIFY` variable to `true` - eg.: `make test-e2e DISABLE_KUBE_CLIENT_TLS_VERIFY=true`. This flag helps when you test in clusters using Self-Signed Certificates. +NOTE: you can specify a regular expression to selectively run particular test cases by setting the `TESTS_RUN_FILTER_REGEXP` variable. eg.: `make test-e2e TESTS_RUN_FILTER_REGEXP="TestSetupMigration"`. For more information see the https://pkg.go.dev/cmd/go#hdr-Testing_flags[go test -run documentation]. + === Running/Debugging e2e tests from your IDE In order to run/debug tests from your IDE you'll need to export some required env variables, those will be used by the test framework to interact with the operator namespaces and the other toolchain resources in you cluster. diff --git a/make/test.mk b/make/test.mk index 75b02628c..fd7f9cc8b 100644 --- a/make/test.mk +++ b/make/test.mk @@ -36,6 +36,8 @@ endif E2E_PARALLELISM=1 +TESTS_RUN_FILTER_REGEXP ?= "" + .PHONY: test-e2e ## Run the e2e tests test-e2e: INSTALL_OPERATOR=true @@ -130,7 +132,7 @@ execute-tests: @echo "Status of ToolchainStatus" -oc get ToolchainStatus -n ${HOST_NS} -o yaml @echo "Starting test $(shell date)" - MEMBER_NS=${MEMBER_NS} MEMBER_NS_2=${MEMBER_NS_2} HOST_NS=${HOST_NS} REGISTRATION_SERVICE_NS=${REGISTRATION_SERVICE_NS} go test ${TESTS_TO_EXECUTE} -p 1 -parallel ${E2E_PARALLELISM} -v -timeout=90m -failfast || \ + MEMBER_NS=${MEMBER_NS} MEMBER_NS_2=${MEMBER_NS_2} HOST_NS=${HOST_NS} REGISTRATION_SERVICE_NS=${REGISTRATION_SERVICE_NS} go test ${TESTS_TO_EXECUTE} -run ${TESTS_RUN_FILTER_REGEXP} -p 1 -parallel ${E2E_PARALLELISM} -v -timeout=90m -failfast || \ ($(MAKE) print-logs HOST_NS=${HOST_NS} MEMBER_NS=${MEMBER_NS} MEMBER_NS_2=${MEMBER_NS_2} REGISTRATION_SERVICE_NS=${REGISTRATION_SERVICE_NS} && exit 1) .PHONY: print-logs From afc1723bf5e70b2e0be8094e41de7c5fae90a8f9 Mon Sep 17 00:00:00 2001 From: David Peraza Date: Tue, 3 Oct 2023 10:05:04 -0400 Subject: [PATCH 2/2] remove --all option from oc get command (#806) Signed-off-by: David Peraza Co-authored-by: Matous Jobanek --- make/clean.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/clean.mk b/make/clean.mk index 9b2acd27d..67b8a906c 100644 --- a/make/clean.mk +++ b/make/clean.mk @@ -68,7 +68,7 @@ clean-all-toolchain-resources: CRD_NAME=`oc get $${CRD} --template '{{.metadata.name}}'`; \ oc delete $${CRD_NAME} --all --all-namespaces; \ done - $(Q)oc get clusterresourcequotas -l "toolchain.dev.openshift.com/provider"=codeready-toolchain --all --all-namespaces + $(Q)oc get clusterresourcequotas -l "toolchain.dev.openshift.com/provider"=codeready-toolchain --all-namespaces .PHONY: clean-toolchain-crds ## Delete all Toolchain CRDs