@@ -65,17 +65,24 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
6565# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
6666# CertManager is installed by default; skip with:
6767# - CERT_MANAGER_INSTALL_SKIP=true
68- .PHONY : test-e2e
69- test-e2e : manifests generate fmt vet # # Run the e2e tests. Expected an isolated environment using Kind.
70- @command -v kind > /dev/null 2>&1 || { \
68+ KIND_CLUSTER ?= atom-operator-v3-test-e2e
69+
70+ .PHONY : setup-test-e2e
71+ setup-test-e2e : # # Set up a Kind cluster for e2e tests if it does not exist
72+ @command -v $(KIND ) > /dev/null 2>&1 || { \
7173 echo " Kind is not installed. Please install Kind manually." ; \
7274 exit 1; \
7375 }
74- @kind get clusters | grep -q ' kind' || { \
75- echo " No Kind cluster is running. Please start a Kind cluster before running the e2e tests." ; \
76- exit 1; \
77- }
78- go test ./test/e2e/ -v -ginkgo.v
76+ $(KIND ) create cluster --name $(KIND_CLUSTER )
77+
78+ .PHONY : test-e2e
79+ test-e2e : setup-test-e2e manifests generate fmt vet # # Run the e2e tests. Expected an isolated environment using Kind.
80+ KIND_CLUSTER=$(KIND_CLUSTER ) go test ./test/e2e/ -v -ginkgo.v
81+ $(MAKE ) cleanup-test-e2e
82+
83+ .PHONY : cleanup-test-e2e
84+ cleanup-test-e2e : # # Tear down the Kind cluster used for e2e tests
85+ @$(KIND ) delete cluster --name $(KIND_CLUSTER )
7986
8087.PHONY : lint
8188lint : golangci-lint # # Run golangci-lint linter
@@ -165,19 +172,20 @@ $(LOCALBIN):
165172
166173# # Tool Binaries
167174KUBECTL ?= kubectl
175+ KIND ?= kind
168176KUSTOMIZE ?= $(LOCALBIN ) /kustomize
169177CONTROLLER_GEN ?= $(LOCALBIN ) /controller-gen
170178ENVTEST ?= $(LOCALBIN ) /setup-envtest
171179GOLANGCI_LINT = $(LOCALBIN ) /golangci-lint
172180
173181# # Tool Versions
174- KUSTOMIZE_VERSION ?= v5.5 .0
175- CONTROLLER_TOOLS_VERSION ?= v0.17.2
182+ KUSTOMIZE_VERSION ?= v5.6 .0
183+ CONTROLLER_TOOLS_VERSION ?= v0.18.0
176184# ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
177185ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-% d.% d", $$2, $$3}')
178186# ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
179187ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.% d", $$3}')
180- GOLANGCI_LINT_VERSION ?= v1.63.4
188+ GOLANGCI_LINT_VERSION ?= v2.1.0
181189
182190.PHONY : kustomize
183191kustomize : $(KUSTOMIZE ) # # Download kustomize locally if necessary.
@@ -205,7 +213,7 @@ $(ENVTEST): $(LOCALBIN)
205213.PHONY : golangci-lint
206214golangci-lint : $(GOLANGCI_LINT ) # # Download golangci-lint locally if necessary.
207215$(GOLANGCI_LINT ) : $(LOCALBIN )
208- $(call go-install-tool,$(GOLANGCI_LINT ) ,github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION ) )
216+ $(call go-install-tool,$(GOLANGCI_LINT ) ,github.com/golangci/golangci-lint/v2/ cmd/golangci-lint,$(GOLANGCI_LINT_VERSION ) )
209217
210218# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
211219# $1 - target path with name of binary
0 commit comments