From fd56789464cd1b3c22d71ad04aa19a84fdf358a7 Mon Sep 17 00:00:00 2001 From: huabing zhao Date: Mon, 26 Feb 2024 16:35:52 +0800 Subject: [PATCH] fix check Signed-off-by: huabing zhao --- Makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c3d5122..f56f724 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ BUILD_OPTS ?= TEST_OPTS ?= TEST_PKGS ?= $(shell go list ./... | grep -v /e2e) OUTDIR ?= bin -ENVTEST ?= sigs.k8s.io/controller-runtime/tools/setup-envtest +ENVTEST ?= sigs.k8s.io/controller-runtime/tools/setup-envtest@latest include env.mk # Load common variables @@ -90,11 +90,10 @@ test: ## Run all the tests COVERAGE_OPTS ?= .PHONY: coverage -coverage: ## Creates coverage report for all projects +coverage: setup-envtest ## Creates coverage report for all projects @echo "Running test coverage" @mkdir -p $(OUTDIR)/$@ - @go get $(ENVTEST) - KUBEBUILDER_ASSETS="$(shell go run $(ENVTEST) use -p path)" \ + KUBEBUILDER_ASSETS="$(shell setup-envtest use -p path)" \ go test $(COVERAGE_OPTS) \ --tags=integration \ -timeout 30s \ @@ -103,6 +102,10 @@ coverage: ## Creates coverage report for all projects $(TEST_PKGS) @go tool cover -html="$(OUTDIR)/$@/coverage.out" -o "$(OUTDIR)/$@/coverage.html" +.PHONY: setup-envtest +setup-envtest: ## Setup the envtest for the integration tests + @go install $(ENVTEST) + .PHONY: e2e e2e: ## Runt he e2e tests @$(MAKE) -C e2e e2e