Skip to content

Commit

Permalink
tests: Add TEST_PATHS target for make test
Browse files Browse the repository at this point in the history
TEST_PATHS defaults to the previous hardcoded value of './...', but can
now be overridden. e.g. To run just the controller tests:

  make test TEST_PATHS=./controllers/...
  • Loading branch information
mdbooth committed Mar 1, 2024
1 parent 120bc68 commit a4e2079
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,13 @@ ifdef KUBEBUILDER_ASSETS_DIR
endif

.PHONY: test
TEST_PATHS ?= ./...
test: $(SETUP_ENVTEST) ## Run tests
set -xeuf -o pipefail; \
if [ -z "$(KUBEBUILDER_ASSETS)" ]; then \
KUBEBUILDER_ASSETS=`$(SETUP_ENVTEST) use --use-env -p path $(setup_envtest_extra_args) $(KUBEBUILDER_ENVTEST_KUBERNETES_VERSION)`; \
fi; \
KUBEBUILDER_ASSETS="$$KUBEBUILDER_ASSETS" go test -v ./... $(TEST_ARGS)
KUBEBUILDER_ASSETS="$$KUBEBUILDER_ASSETS" go test -v $(TEST_PATHS) $(TEST_ARGS)

E2E_TEMPLATES_DIR=test/e2e/data/infrastructure-openstack
E2E_KUSTOMIZE_DIR=test/e2e/data/kustomize
Expand Down

0 comments on commit a4e2079

Please sign in to comment.