Skip to content

Commit 4d0d3cc

Browse files
committed
Use go run for ginkgo CLI
[Why] To avoid mismatch version between Ginkgo version in Go mod vs the Ginkgo CLI installed locally in GOBIN. The change to the port number in testenv is to avoid using ports outside of valid range (1-65536) when Ginkgo parallel processes was over 10. Previously, the process number 10 would render port 81810, which is outside of the valid range.
1 parent de8c024 commit 4d0d3cc

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export KUBEBUILDER_ASSETS = $(LOCAL_TESTBIN)/k8s/$(ENVTEST_K8S_VERSION)-$(platfo
5454

5555
.PHONY: kubebuilder-assets
5656
kubebuilder-assets: $(KUBEBUILDER_ASSETS)
57+
@echo "export KUBEBUILDER_ASSETS = $(LOCAL_TESTBIN)/k8s/$(ENVTEST_K8S_VERSION)-$(platform)-$(ARCHITECTURE)"
5758

5859
$(KUBEBUILDER_ASSETS):
5960
setup-envtest --os $(platform) --arch $(ARCHITECTURE) --bin-dir $(LOCAL_TESTBIN) use $(ENVTEST_K8S_VERSION)
@@ -73,6 +74,8 @@ $(YTT): | $(LOCAL_BIN)
7374
##############
7475
#### Tests ###
7576
##############
77+
GINKGO := go run github.com/onsi/ginkgo/v2/ginkgo
78+
7679
.PHONY: unit-tests
7780
unit-tests::install-tools ## Run unit tests
7881
unit-tests::$(KUBEBUILDER_ASSETS)
@@ -84,7 +87,7 @@ unit-tests::just-unit-tests
8487

8588
.PHONY: just-unit-tests
8689
just-unit-tests:
87-
ginkgo -r --randomize-all api/ internal/ rabbitmqclient/
90+
$(GINKGO) -r --randomize-all api/ internal/ rabbitmqclient/
8891

8992
.PHONY: integration-tests
9093
integration-tests::install-tools ## Run integration tests. Use GINKGO_EXTRA="-some-arg" to append arguments to 'ginkgo run'
@@ -96,14 +99,14 @@ integration-tests::manifests
9699
integration-tests::just-integration-tests
97100

98101
just-integration-tests: $(KUBEBUILDER_ASSETS)
99-
ginkgo --randomize-all -r -p $(GINKGO_EXTRA) controllers/
102+
$(GINKGO) --randomize-all -r -p $(GINKGO_EXTRA) controllers/
100103

101104
.PHONY: local-tests
102105
local-tests: unit-tests integration-tests ## Run all local tests (unit & integration)
103106

104107
.PHONY: system-tests
105108
system-tests: ## Run E2E tests using current context in ~/.kube/config. Expects cluster operator and topology operator to be installed in the cluster
106-
NAMESPACE="rabbitmq-system" ginkgo --randomize-all -r $(GINKGO_EXTRA) system_tests/
109+
NAMESPACE="rabbitmq-system" $(GINKGO) --randomize-all -r $(GINKGO_EXTRA) system_tests/
107110

108111

109112
###################

controllers/suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ var _ = BeforeSuite(func() {
112112
CRDDirectoryPaths: operatorCrds,
113113
ErrorIfCRDPathMissing: true,
114114
Config: &rest.Config{
115-
Host: fmt.Sprintf("localhost:818%d", GinkgoParallelProcess()),
115+
Host: fmt.Sprintf("localhost:218%d", GinkgoParallelProcess()),
116116
},
117117
}
118118

0 commit comments

Comments
 (0)