@@ -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.
68+ KIND_CLUSTER ?= cluster-api-provider-scaleway-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
7072 @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
@@ -173,12 +180,12 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
173180
174181# # Tool Versions
175182KUSTOMIZE_VERSION ?= v5.6.0
176- CONTROLLER_TOOLS_VERSION ?= v0.17.2
183+ CONTROLLER_TOOLS_VERSION ?= v0.18.0
177184# ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
178185ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-% d.% d", $$2, $$3}')
179186# ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
180187ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.% d", $$3}')
181- GOLANGCI_LINT_VERSION ?= v1.63.4
188+ GOLANGCI_LINT_VERSION ?= v2.1.0
182189
183190.PHONY : kustomize
184191kustomize : $(KUSTOMIZE ) # # Download kustomize locally if necessary.
@@ -206,7 +213,7 @@ $(ENVTEST): $(LOCALBIN)
206213.PHONY : golangci-lint
207214golangci-lint : $(GOLANGCI_LINT ) # # Download golangci-lint locally if necessary.
208215$(GOLANGCI_LINT ) : $(LOCALBIN )
209- $(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 ) )
210217
211218# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
212219# $1 - target path with name of binary
0 commit comments