Skip to content

Commit d7c66b9

Browse files
Fix make file to run tests
1 parent ded6321 commit d7c66b9

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ VERSION ?= $(shell git describe --tags --always --dirty)
55

66
KUBERNETES_VERSION = 1.27
77
ENVTEST_BIN_ROOT = /tmp/testbin
8-
KUBEBUILDER_ASSETS_PATH = $(shell setup-envtest use $(KUBERNETES_VERSION) --bin-dir=$(ENVTEST_BIN_ROOT) | grep 'Path:' | awk '{print $$2}')
8+
9+
GOBIN ?= $(shell go env GOBIN)
10+
ifeq ($(GOBIN),)
11+
GOBIN := $(shell go env GOPATH)/bin
12+
endif
13+
SETUP_ENVTEST := $(GOBIN)/setup-envtest
14+
15+
KUBEBUILDER_ASSETS_PATH = $(shell $(SETUP_ENVTEST) use $(KUBERNETES_VERSION) --bin-dir=$(ENVTEST_BIN_ROOT) | grep 'Path:' | awk '{print $$2}')
916

1017
.PHONY: all build clean test setup-envtest fetch-envtest-binaries
1118

@@ -27,7 +34,7 @@ setup-envtest:
2734
fetch-envtest-binaries:
2835
@echo "🌐 Downloading Kubernetes binaries for envtest..."
2936
mkdir -p $(ENVTEST_BIN_ROOT)
30-
@setup-envtest use $(KUBERNETES_VERSION) --bin-dir=$(ENVTEST_BIN_ROOT)
37+
@$(SETUP_ENVTEST) use $(KUBERNETES_VERSION) --bin-dir=$(ENVTEST_BIN_ROOT)
3138
@echo "✅ Binaries fetched into $(KUBEBUILDER_ASSETS_PATH)"
3239

3340
test: fetch-envtest-binaries

0 commit comments

Comments
 (0)