Skip to content

Commit e82ebca

Browse files
committed
Drop UNIT_TEST_DIRS for TEST_PKGS + TEST_FILTER
Signed-off-by: Brett Tofel <[email protected]>
1 parent d09f74d commit e82ebca

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,11 @@ test-ext-dev-e2e: $(OPERATOR_SDK) $(KUSTOMIZE) $(KIND) #HELP Run extension creat
208208
test/extension-developer-e2e/setup.sh $(OPERATOR_SDK) $(CONTAINER_RUNTIME) $(KUSTOMIZE) $(KIND) $(KIND_CLUSTER_NAME) $(E2E_REGISTRY_NAMESPACE)
209209
go test -count=1 -v ./test/extension-developer-e2e/...
210210

211-
UNIT_TEST_DIRS := $(shell go list ./... | grep -v /test/)
211+
ENVTEST_VERSION := $(shell go list -m k8s.io/client-go | cut -d" " -f2 | sed 's/^v0\.\([[:digit:]]\{1,\}\)\.[[:digit:]]\{1,\}$$/1.\1.x/')
212+
# Define TEST_PKGS to be either user-specified or a default set of packages:
213+
ifeq ($(origin TEST_PKGS), undefined)
214+
TEST_PKGS := $(shell go list ./... | grep -v /test/)
215+
endif
212216
COVERAGE_UNIT_DIR := $(ROOT_DIR)/coverage/unit
213217

214218
.PHONY: envtest-k8s-bins #HELP Uses setup-envtest to download and install the binaries required to run ENVTEST-test based locally at the project/bin directory.
@@ -225,7 +229,7 @@ test-unit: $(SETUP_ENVTEST) envtest-k8s-bins #HELP Run the unit tests
225229
-cover -coverprofile ${ROOT_DIR}/coverage/unit.out \
226230
-count=1 -race -short \
227231
-run "$(if $(TEST_FILTER),$(TEST_FILTER),.)" \
228-
$(if $(TEST_PKG),$(TEST_PKG),$(UNIT_TEST_DIRS)) \
232+
$(TEST_PKGS) \
229233
-test.gocoverdir=$(COVERAGE_UNIT_DIR)
230234

231235
.PHONY: image-registry

0 commit comments

Comments
 (0)