Skip to content

Commit cab7051

Browse files
author
Michael Chinigo
authored
Install ginkgo "out of the box" (#2920)
* Install ginkgo "out of the box" This change installs the version of Ginkgo specified in go.mod, modifies the Makefile to do this before each flavor of test, and simplifies the CI tasks that invoke these tests. Prior to this change, the Makefile assumes the presence of a system-level installation of Ginkgo. That installation of Ginkgo will not necessarily match the version specified in our go.mod. This introduces the (slight) possibility of subtle differences in the behavior of the test library. It also complicates spinning up a new environment, either for a developer or in CI. * No longer install gomega matchers as a system-level dependency These matchers are imported as needed in the test files that need them. There is no need to install them as a system-level dependency, so let's not.
1 parent 334489f commit cab7051

File tree

3 files changed

+20
-29
lines changed

3 files changed

+20
-29
lines changed

.github/workflows/tests-integration-reusable.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,6 @@ jobs:
249249
250250
make build
251251
252-
go install github.com/onsi/ginkgo/v2/ginkgo
253-
254252
export CF_PASSWORD=${CF_INT_PASSWORD}
255253
cf api ${CF_INT_API} --skip-ssl-validation
256254
cf auth
@@ -281,8 +279,6 @@ jobs:
281279
282280
make build
283281
284-
go install github.com/onsi/ginkgo/v2/ginkgo
285-
286282
export CF_PASSWORD=${CF_INT_PASSWORD}
287283
cf api ${CF_INT_API} --skip-ssl-validation
288284
cf auth

.github/workflows/tests-unit.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ jobs:
6565
go-version-file: go.mod
6666
check-latest: true
6767

68-
- name: Set Up Test
69-
run: |
70-
go install github.com/onsi/ginkgo/v2/ginkgo
71-
go install github.com/onsi/gomega/matchers
72-
7368
- name: Run Units
7469
run: make units
7570

@@ -96,11 +91,6 @@ jobs:
9691
go-version-file: go.mod
9792
check-latest: true
9893

99-
- name: Set up Test
100-
run: |
101-
go install github.com/onsi/ginkgo/v2/ginkgo
102-
go install github.com/onsi/gomega/matchers
103-
10494
- name: Get build-time dependencies
10595
run: |
10696
choco install --no-progress --limit-output -y make

Makefile

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ fly-windows-units:
7171
format: ## Run go fmt
7272
go fmt ./...
7373

74+
install-test-deps: ## Install "global" dependencies needed to run tests
75+
# Running `go install <pkg>` without a version specifier will use version specified in go.mod
76+
# See https://go.dev/ref/mod#go-install
77+
go install github.com/onsi/ginkgo/v2/ginkgo
78+
7479
integration-cleanup:
7580
$(CURDIR)/bin/cleanup-integration
7681

@@ -79,55 +84,55 @@ integration-experimental: build integration-cleanup integration-shared-experimen
7984

8085
ise: integration-shared-experimental
8186
integration-experimental-shared: integration-shared-experimental
82-
integration-shared-experimental: build integration-cleanup ## Run experimental integration tests that are shared between v6 and v7
87+
integration-shared-experimental: build install-test-deps integration-cleanup ## Run experimental integration tests that are shared between v6 and v7
8388
$(ginkgo_int) -nodes $(NODES) integration/shared/experimental
8489

8590
ive: integration-versioned-experimental
8691
integration-experimental-versioned: integration-versioned-experimental
87-
integration-versioned-experimental: build integration-cleanup ## Run experimental integration tests that are specific to your CLI version
92+
integration-versioned-experimental: build install-test-deps integration-cleanup ## Run experimental integration tests that are specific to your CLI version
8893
$(ginkgo_int) -nodes $(NODES) integration/v7/experimental
8994

9095
ig: integration-global
9196
integration-global: build integration-cleanup integration-shared-global integration-global-versioned ## Run all unparallelizable integration tests that make cross-cutting changes to their test CF foundation
9297

9398
isg: integration-shared-global
9499
integration-global-shared: integration-shared-global
95-
integration-shared-global: build integration-cleanup ## Serially run integration tests that make cross-cutting changes to their test CF foundation and are shared between v6 and v7
100+
integration-shared-global: build install-test-deps integration-cleanup ## Serially run integration tests that make cross-cutting changes to their test CF foundation and are shared between v6 and v7
96101
$(ginkgo_int) integration/shared/global
97102

98103
ivg: integration-versioned-global
99104
integration-global-versioned: integration-versioned-global
100-
integration-versioned-global: build integration-cleanup ## Serially run integration tests that make cross-cutting changes to their test CF foundation and are specific to your CLI version
105+
integration-versioned-global: build install-test-deps integration-cleanup ## Serially run integration tests that make cross-cutting changes to their test CF foundation and are specific to your CLI version
101106
$(ginkgo_int) integration/v7/global
102107

103108
ii: integration-isolated
104109
integration-isolated: build integration-cleanup integration-shared-isolated integration-isolated-versioned ## Run all parallel-enabled integration tests, both versioned and shared across versions
105110

106111
isi: integration-shared-isolated
107112
integration-isolated-shared: integration-shared-isolated
108-
integration-shared-isolated: build integration-cleanup ## Run all parallel-enabled integration tests that are shared between v6 and v7
113+
integration-shared-isolated: build install-test-deps integration-cleanup ## Run all parallel-enabled integration tests that are shared between v6 and v7
109114
$(ginkgo_int) -nodes $(NODES) integration/shared/isolated
110115

111116
integration-performance: build integration-cleanup integration-shared-performance
112117

113118
isp: integration-shared-performance
114119
integration-performance-shared: integration-shared-performance
115-
integration-shared-performance: build integration-cleanup
120+
integration-shared-performance: build install-test-deps integration-cleanup
116121
$(ginkgo_int) integration/shared/performance
117122

118123
ivi: integration-versioned-isolated
119124
integration-isolated-versioned: integration-versioned-isolated
120-
integration-versioned-isolated: build integration-cleanup ## Run all parallel-enabled integration tests, both versioned and shared across versions
125+
integration-versioned-isolated: build install-test-deps integration-cleanup ## Run all parallel-enabled integration tests, both versioned and shared across versions
121126
$(ginkgo_int) -nodes $(NODES) integration/v7/isolated
122127

123-
integration-plugin: build integration-cleanup ## Run all plugin-related integration tests
128+
integration-plugin: build install-test-deps integration-cleanup ## Run all plugin-related integration tests
124129
$(ginkgo_int) -nodes $(NODES) integration/shared/plugin
125130

126131
ip: integration-push
127-
integration-push: build integration-cleanup ## Run all push-related integration tests
132+
integration-push: build install-test-deps integration-cleanup ## Run all push-related integration tests
128133
$(ginkgo_int) -nodes $(NODES) integration/v7/push
129134

130-
integration-selfcontained: build
135+
integration-selfcontained: build install-test-deps
131136
$(ginkgo_int) -nodes $(NODES) integration/v7/selfcontained
132137

133138
integration-tests: build integration-cleanup integration-isolated integration-push integration-global integration-selfcontained ## Run all isolated, push, selfcontained, and global integration tests
@@ -137,7 +142,7 @@ i: integration-tests-full
137142
integration-full-tests: integration-tests-full
138143
integration-tests-full: build integration-cleanup integration-isolated integration-push integration-experimental integration-plugin integration-global integration-selfcontained ## Run all isolated, push, experimental, plugin, selfcontained, and global integration tests
139144

140-
integration-tests-full-ci: integration-cleanup
145+
integration-tests-full-ci: install-test-deps integration-cleanup
141146
$(ginkgo_int) -nodes $(NODES) -flake-attempts $(FLAKE_ATTEMPTS) \
142147
integration/shared/isolated integration/v7/isolated integration/shared/plugin integration/shared/experimental integration/v7/experimental integration/v7/push
143148
$(ginkgo_int) -flake-attempts $(FLAKE_ATTEMPTS) integration/shared/global integration/v7/global
@@ -199,18 +204,18 @@ test: units ## (synonym for units)
199204

200205
units: units-full ## (synonym for units-full)
201206

202-
units-plugin:
207+
units-plugin: install-test-deps
203208
CF_HOME=$(CURDIR)/fixtures $(ginkgo_units) -nodes 1 -flake-attempts 2 -skip-package integration ./**/plugin* ./plugin
204209

205210
ifeq ($(OS),Windows_NT)
206-
units-non-plugin:
211+
units-non-plugin: install-test-deps
207212
@rm -f $(wildcard fixtures/plugins/*.exe)
208213
@ginkgo version
209214
CF_HOME=$(CURDIR)/fixtures CF_USERNAME="" CF_PASSWORD="" $(ginkgo_units) \
210215
-skip-package integration,cf\ssh,plugin,cf\actors\plugin,cf\commands\plugin,cf\actors\plugin,util\randomword
211216
CF_HOME=$(CURDIR)/fixtures $(ginkgo_units) -flake-attempts 3 cf/ssh
212217
else
213-
units-non-plugin:
218+
units-non-plugin: install-test-deps
214219
@rm -f $(wildcard fixtures/plugins/*.exe)
215220
@ginkgo version
216221
CF_HOME=$(CURDIR)/fixtures CF_USERNAME="" CF_PASSWORD="" $(ginkgo_units) \
@@ -225,7 +230,7 @@ version: ## Print the version number of what would be built
225230
@echo $(CF_BUILD_VERSION)+$(CF_BUILD_SHA).$(CF_BUILD_DATE)
226231

227232
.PHONY: all build clean format version lint custom-lint
228-
.PHONY: test units units-full integration integration-tests-full integration-cleanup integration-experimental integration-plugin integration-isolated integration-push
233+
.PHONY: test units units-full install-test-deps integration integration-tests-full integration-cleanup integration-experimental integration-plugin integration-isolated integration-push
229234
.PHONY: check-target-env fly-windows-experimental fly-windows-isolated fly-windows-plugin fly-windows-push
230235
.PHONY: help
231236

0 commit comments

Comments
 (0)