Skip to content

Commit 0308d96

Browse files
committed
test: ginkgo
1 parent 6a67740 commit 0308d96

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ infrastructure-components.yaml
1919

2020
# Output of the go coverage tool, specifically when used with LiteIDE
2121
*.out
22+
junit.e2e_suite.xml
2223

2324
# Go workspace file
2425
go.work

Makefile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ 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 -- $$(go list ./... | grep -v /e2e) -coverprofile cover.out
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:
@@ -124,7 +124,7 @@ E2E_FIREWALL_NETWORKS ?= "internet-mini-lab"
124124
ARTIFACTS ?= "$(PWD)/_artifacts"
125125

126126
.PHONY: test-e2e
127-
test-e2e: manifests generate fmt vet
127+
test-e2e: manifests generate fmt vet ginkgo
128128
rm -rf test/e2e/frmwrk/artifacts
129129

130130
mkdir -p $(ARTIFACTS)/config/target
@@ -145,7 +145,7 @@ test-e2e: manifests generate fmt vet
145145
FIREWALL_SIZE=$(E2E_FIREWALL_SIZE) \
146146
FIREWALL_NETWORKS=$(E2E_FIREWALL_NETWORKS) \
147147
ARTIFACTS=$(ARTIFACTS) \
148-
go test -v ./test/e2e/frmwrk -timeout 60m -v ginkgo -vv --output-dir="$(ARTIFACTS)" --junit-report="junit.e2e_suite.xml"
148+
$(GINKGO) -vv -r --junit-report="junit.e2e_suite.xml" --cover -- ./test/e2e/frmwrk -timeout 60m
149149

150150
.PHONY: lint
151151
lint: golangci-lint ## Run golangci-lint linter
@@ -239,13 +239,15 @@ KUBECTL ?= kubectl
239239
KUSTOMIZE ?= $(LOCALBIN)/kustomize
240240
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
241241
ENVTEST ?= $(LOCALBIN)/setup-envtest
242+
GINKGO ?= $(LOCALBIN)/ginkgo
242243
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
243244

244245
## Tool Versions
245246
KUSTOMIZE_VERSION ?= v5.4.3
246247
CONTROLLER_TOOLS_VERSION ?= v0.16.4
247248
ENVTEST_VERSION ?= release-0.19
248249
GOLANGCI_LINT_VERSION ?= v1.61.0
250+
GINKGO_VERSION ?= v2.23.3
249251

250252
.PHONY: kustomize
251253
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -267,6 +269,11 @@ golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
267269
$(GOLANGCI_LINT): $(LOCALBIN)
268270
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
269271

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+
270277
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
271278
# $1 - target path with name of binary
272279
# $2 - package url which can be installed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/metal-stack/cluster-api-provider-metal-stack
33
go 1.23.0
44

55
require (
6+
github.com/drone/envsubst/v2 v2.0.0-20210730161058-179042472c46
67
github.com/go-logr/logr v1.4.2
78
github.com/metal-stack/metal-go v0.40.4
89
github.com/metal-stack/metal-lib v0.20.2
@@ -46,7 +47,6 @@ require (
4647
github.com/docker/docker v28.0.2+incompatible // indirect
4748
github.com/docker/go-connections v0.5.0 // indirect
4849
github.com/docker/go-units v0.5.0 // indirect
49-
github.com/drone/envsubst/v2 v2.0.0-20210730161058-179042472c46 // indirect
5050
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
5151
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
5252
github.com/fatih/color v1.18.0 // indirect

0 commit comments

Comments
 (0)