From 6223425aa3b473ab9fcb7540c29e0da8b9d11301 Mon Sep 17 00:00:00 2001 From: grokspawn Date: Wed, 16 Jul 2025 15:59:48 -0500 Subject: [PATCH] normalize unit test targets across repos. add skip/target test args Signed-off-by: grokspawn --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index e9865fcb1..400f8ef16 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ endif REPO = github.com/operator-framework/api BUILD_PATH = $(REPO)/cmd/operator-verify PKGS = $(shell go list ./... | grep -v /vendor/) +SPECIFIC_UNIT_TEST := $(if $(TEST),-run $(TEST),) +SPECIFIC_SKIP_UNIT_TEST := $(if $(SKIP),-skip $(SKIP),) .PHONY: help help: ## Show this help screen @@ -76,13 +78,15 @@ manifests: yq controller-gen ## Generate manifests e.g. CRD, RBAC etc $(Q)go generate ./crds/... # Static tests. -.PHONY: test test-unit verify +.PHONY: test test-unit verify unit test: test-unit ## Run the tests +unit: test-unit ## Run the tests + TEST_PKGS:=$(shell go list ./...) test-unit: ## Run the unit tests - $(Q)go test -count=1 -short ${TEST_PKGS} + $(Q)go test -coverprofile=coverage.out -count=1 ${SPECIFIC_UNIT_TEST} ${SPECIFIC_SKIP_UNIT_TEST} ${TEST_PKGS} verify: manifests generate format tidy git diff --exit-code @@ -132,4 +136,4 @@ $(KIND): $(LOCALBIN) .PHONY: kind-cluster kind-cluster: kind ## Create a kind cluster $(KIND) create cluster --name olmv0 --image $(KIND_CLUSTER_IMAGE) - $(KIND) export kubeconfig --name olmv0 \ No newline at end of file + $(KIND) export kubeconfig --name olmv0