From 1a080e8b4ec86424ae300cb8e9593cfee0d87761 Mon Sep 17 00:00:00 2001 From: Tiger Kaovilai Date: Wed, 8 Jun 2022 20:00:50 -0400 Subject: [PATCH] fix envtest for darwin/arm64 --- Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f4d94b573c..0fc1b3ed5e 100644 --- a/Makefile +++ b/Makefile @@ -164,12 +164,17 @@ vet: ## Run go vet against code. go vet -mod=mod ./... test: manifests generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test -mod=mod ./controllers/... ./pkg/... -coverprofile cover.out + KUBEBUILDER_ASSETS="$(ENVTESTPATH)" go test -mod=mod ./controllers/... ./pkg/... -coverprofile cover.out ENVTEST = $(shell pwd)/bin/setup-envtest +ENVTESTPATH = $(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path) +# if there is no native arch available, attempt to use amd64 +ifeq ($(shell $(ENVTEST) list),) + ENVTESTPATH = $(shell $(ENVTEST) --arch=amd64 use $(ENVTEST_K8S_VERSION) -p path) +endif ci-test: ## This assumes "manifests generate fmt vet envtest" ran. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test -mod=mod ./controllers/... -coverprofile cover.out + KUBEBUILDER_ASSETS="$(ENVTESTPATH)" go test -mod=mod ./controllers/... -coverprofile cover.out ##@ Build