From 653f6a5310d85a740e93786c582314632dcceb0c Mon Sep 17 00:00:00 2001 From: Carlo Lobrano Date: Tue, 11 Jul 2023 12:11:12 +0200 Subject: [PATCH] Permit to pass further options to Makefile test targets Add TEST_OPS variable to permit passing convenient flags while adding or updating tests/features e.g. * -ginkgo.v[v] * -ginkgo.focus Signed-off-by: Carlo Lobrano --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2f92886f..32cbfd8d 100644 --- a/Makefile +++ b/Makefile @@ -163,11 +163,13 @@ BIN_ASSETS_DIR=$(shell pwd)/bin ENVTEST_ASSETS_DIR = ${BIN_ASSETS_DIR}/setup-envtest ENVTEST = $(shell pwd)/bin/setup-envtest +# Use TEST_OPS to pass further options to `go test` (e.g. -gingo.v and/or -ginkgo.focus) +export TEST_OPS ?= "" .PHONY: test test: envtest manifests generate fmt vet ## Run tests. KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path --bin-dir $(PROJECT_DIR)/testbin)" \ KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT="60s"\ - go test ./api/... ./controllers/... ./pkg/... -coverprofile cover.out -v + go test ./api/... ./controllers/... ./pkg/... -coverprofile cover.out -v ${TEST_OPS} .PHONY: bundle-run export BUNDLE_RUN_NAMESPACE ?= openshift-operators @@ -328,7 +330,7 @@ protoc-gen-go-grpc: ## Download protoc-gen-go-grpc locally if necessary. e2e-test: # KUBECONFIG must be set to the cluster, and PP needs to be deployed already # count arg makes the test ignoring cached test results - go test ./e2e -ginkgo.v -ginkgo.progress -test.v -timeout 60m -count=1 + go test ./e2e -ginkgo.v -ginkgo.progress -test.v -timeout 60m -count=1 ${TEST_OPS} .PHONY: operator-sdk OPERATOR_SDK_BIN_FOLDER = ./bin/operator-sdk @@ -429,4 +431,4 @@ fix-imports: sort-imports ## Sort imports $(SORT_IMPORTS) -w . .PHONY: full-gen -full-gen: generate manifests vendor tidy bundle fix-imports bundle-reset ## generates all automatically generated content \ No newline at end of file +full-gen: generate manifests vendor tidy bundle fix-imports bundle-reset ## generates all automatically generated content