@@ -77,7 +77,7 @@ update-test-crds:
7777 go mod tidy
7878 rm -rf test/external-crds
7979 mkdir -p test/external-crds/cluster-api
80- cp -f $(shell go list -mod=mod -m -f '{{.Dir}}' all | grep sigs.k8s.io/cluster-api) /config/crd/bases/* test/external-crds/cluster-api
80+ cp -f $(shell go list -mod=mod -m -f '{{.Dir}}' all | grep sigs.k8s.io/cluster-api@ ) /config/crd/bases/* test/external-crds/cluster-api
8181
8282.PHONY : fmt
8383fmt : # # Run go fmt against code.
@@ -88,15 +88,15 @@ vet: ## Run go vet against code.
8888 go vet ./...
8989
9090.PHONY : test
91- test : manifests generate update-test-crds fmt vet envtest # # Run tests.
92- KUBEBUILDER_ASSETS=" $( shell $( ENVTEST) use $( ENVTEST_K8S_VERSION) --bin-dir $( LOCALBIN) -p path) " go test $$(go list ./... | grep -v /e2e ) -coverprofile cover.out
91+ test : manifests generate update-test-crds fmt vet envtest ginkgo # # Run tests.
92+ KUBEBUILDER_ASSETS=" $( shell $( ENVTEST) use $( ENVTEST_K8S_VERSION) --bin-dir $( LOCALBIN) -p path) " $( GINKGO ) -r --junit-report= " junit.e2e_suite.xml " --cover -coverprofile cover.out $$(go list ./... | grep -v /e2e | sed "s|github.com/metal-stack/cluster-api-provider-metal-stack|.|" )
9393
9494# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
9595# Prometheus and CertManager are installed by default; skip with:
9696# - PROMETHEUS_INSTALL_SKIP=true
9797# - CERT_MANAGER_INSTALL_SKIP=true
98- .PHONY : test-e2e
99- test-e2e : manifests generate update-test-crds fmt vet # # Run the e2e tests. Expected an isolated environment using Kind.
98+ .PHONY : test-e2e-controller
99+ test-e2e-controller : manifests generate update-test-crds fmt vet # # Run the e2e tests. Expected an isolated environment using Kind.
100100 @command -v kind > /dev/null 2>&1 || { \
101101 echo " Kind is not installed. Please install Kind manually." ; \
102102 exit 1; \
@@ -107,6 +107,46 @@ test-e2e: manifests generate update-test-crds fmt vet ## Run the e2e tests. Expe
107107 }
108108 go test ./test/e2e/ -v -ginkgo.v
109109
110+ E2E_METAL_API_URL ?= "$(METALCTL_API_URL ) "
111+ E2E_METAL_API_HMAC ?= "$(METALCTL_HMAC ) "
112+ E2E_METAL_API_HMAC_AUTH_TYPE ?= "$(or $(METALCTL_HMAC_AUTH_TYPE ) ,Metal-Admin) "
113+ E2E_METAL_PROJECT_ID ?= "00000000-0000-0000-0000-000000000001"
114+ E2E_METAL_PARTITION ?= "mini-lab"
115+ E2E_METAL_PUBLIC_NETWORK ?= "internet-mini-lab"
116+ E2E_KUBERNETES_VERSIONS ?= "v1.32.9"
117+ E2E_CONTROL_PLANE_MACHINE_IMAGE_PREFIX ?= "capms-ubuntu-"
118+ E2E_CONTROL_PLANE_MACHINE_SIZE ?= "v1-small-x86"
119+ E2E_WORKER_MACHINE_IMAGE_PREFIX ?= "capms-ubuntu-"
120+ E2E_WORKER_MACHINE_SIZE ?= "v1-small-x86"
121+ E2E_FIREWALL_IMAGE ?= "firewall-ubuntu-3.0"
122+ E2E_FIREWALL_SIZE ?= "v1-small-x86"
123+ E2E_FIREWALL_NETWORKS ?= "internet-mini-lab"
124+ ARTIFACTS ?= "$(PWD ) /_artifacts"
125+
126+ .PHONY : test-e2e
127+ test-e2e : manifests generate fmt vet ginkgo
128+ rm -rf test/e2e/frmwrk/artifacts
129+
130+ mkdir -p $(ARTIFACTS)/config/target
131+ kubectl kustomize test/e2e/frmwrk/config/target/base -o $(ARTIFACTS)/config/target/base.yaml
132+
133+ @METAL_API_URL=$(E2E_METAL_API_URL) \
134+ METAL_API_HMAC=$(E2E_METAL_API_HMAC) \
135+ METAL_API_HMAC_AUTH_TYPE=$(E2E_METAL_API_HMAC_AUTH_TYPE) \
136+ METAL_PROJECT_ID=$(E2E_METAL_PROJECT_ID) \
137+ METAL_PARTITION=$(E2E_METAL_PARTITION) \
138+ METAL_PUBLIC_NETWORK=$(E2E_METAL_PUBLIC_NETWORK) \
139+ E2E_KUBERNETES_VERSIONS=$(E2E_KUBERNETES_VERSIONS) \
140+ E2E_CONTROL_PLANE_MACHINE_IMAGE_PREFIX=$(E2E_CONTROL_PLANE_MACHINE_IMAGE_PREFIX) \
141+ CONTROL_PLANE_MACHINE_SIZE=$(E2E_CONTROL_PLANE_MACHINE_SIZE) \
142+ E2E_WORKER_MACHINE_IMAGE_PREFIX=$(E2E_WORKER_MACHINE_IMAGE_PREFIX) \
143+ WORKER_MACHINE_SIZE=$(E2E_WORKER_MACHINE_SIZE) \
144+ FIREWALL_IMAGE=$(E2E_FIREWALL_IMAGE) \
145+ FIREWALL_SIZE=$(E2E_FIREWALL_SIZE) \
146+ FIREWALL_NETWORKS=$(E2E_FIREWALL_NETWORKS) \
147+ ARTIFACTS=$(ARTIFACTS) \
148+ $(GINKGO) -vv -r --junit-report="junit.e2e_suite.xml" --output-dir="$(ARTIFACTS)" -timeout 60m ./test/e2e/frmwrk
149+
110150.PHONY : lint
111151lint : golangci-lint # # Run golangci-lint linter
112152 $(GOLANGCI_LINT ) run
@@ -199,13 +239,15 @@ KUBECTL ?= kubectl
199239KUSTOMIZE ?= $(LOCALBIN ) /kustomize
200240CONTROLLER_GEN ?= $(LOCALBIN ) /controller-gen
201241ENVTEST ?= $(LOCALBIN ) /setup-envtest
242+ GINKGO ?= $(LOCALBIN ) /ginkgo
202243GOLANGCI_LINT = $(LOCALBIN ) /golangci-lint
203244
204245# # Tool Versions
205246KUSTOMIZE_VERSION ?= v5.4.3
206247CONTROLLER_TOOLS_VERSION ?= v0.16.4
207248ENVTEST_VERSION ?= release-0.19
208249GOLANGCI_LINT_VERSION ?= v1.61.0
250+ GINKGO_VERSION ?= v2.23.3
209251
210252.PHONY : kustomize
211253kustomize : $(KUSTOMIZE ) # # Download kustomize locally if necessary.
@@ -227,6 +269,11 @@ golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
227269$(GOLANGCI_LINT ) : $(LOCALBIN )
228270 $(call go-install-tool,$(GOLANGCI_LINT ) ,github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION ) )
229271
272+ .PHONY : ginkgo
273+ ginkgo : $(GINKGO ) # # Download setup-envtest locally if necessary.
274+ $(GINKGO ) : $(LOCALBIN )
275+ $(call go-install-tool,$(GINKGO ) ,github.com/onsi/ginkgo/v2/ginkgo,$(GINKGO_VERSION ) )
276+
230277# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
231278# $1 - target path with name of binary
232279# $2 - package url which can be installed
0 commit comments