Skip to content

Commit d6a691f

Browse files
authored
normalize unit test targets across repos. add skip/target test args (#438)
Signed-off-by: grokspawn <jordan@nimblewidget.com>
1 parent d34b367 commit d6a691f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ endif
1212
REPO = github.com/operator-framework/api
1313
BUILD_PATH = $(REPO)/cmd/operator-verify
1414
PKGS = $(shell go list ./... | grep -v /vendor/)
15+
SPECIFIC_UNIT_TEST := $(if $(TEST),-run $(TEST),)
16+
SPECIFIC_SKIP_UNIT_TEST := $(if $(SKIP),-skip $(SKIP),)
1517

1618
.PHONY: help
1719
help: ## Show this help screen
@@ -76,13 +78,15 @@ manifests: yq controller-gen ## Generate manifests e.g. CRD, RBAC etc
7678
$(Q)go generate ./crds/...
7779

7880
# Static tests.
79-
.PHONY: test test-unit verify
81+
.PHONY: test test-unit verify unit
8082

8183
test: test-unit ## Run the tests
8284

85+
unit: test-unit ## Run the tests
86+
8387
TEST_PKGS:=$(shell go list ./...)
8488
test-unit: ## Run the unit tests
85-
$(Q)go test -count=1 -short ${TEST_PKGS}
89+
$(Q)go test -coverprofile=coverage.out -count=1 ${SPECIFIC_UNIT_TEST} ${SPECIFIC_SKIP_UNIT_TEST} ${TEST_PKGS}
8690

8791
verify: manifests generate format tidy
8892
git diff --exit-code
@@ -132,4 +136,4 @@ $(KIND): $(LOCALBIN)
132136
.PHONY: kind-cluster
133137
kind-cluster: kind ## Create a kind cluster
134138
$(KIND) create cluster --name olmv0 --image $(KIND_CLUSTER_IMAGE)
135-
$(KIND) export kubeconfig --name olmv0
139+
$(KIND) export kubeconfig --name olmv0

0 commit comments

Comments
 (0)