Skip to content

Commit

Permalink
Install ginkgo "out of the box" (v8 branch) (#2927)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
chinigo committed May 15, 2024
1 parent e4eb09f commit 3eaa855
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 29 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/tests-integration-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,6 @@ jobs:
make build
go install github.com/onsi/ginkgo/v2/ginkgo
export CF_PASSWORD=${CF_INT_PASSWORD}
cf api ${CF_INT_API} --skip-ssl-validation
cf auth
Expand Down Expand Up @@ -281,8 +279,6 @@ jobs:
make build
go install github.com/onsi/ginkgo/v2/ginkgo
export CF_PASSWORD=${CF_INT_PASSWORD}
cf api ${CF_INT_API} --skip-ssl-validation
cf auth
Expand Down
10 changes: 0 additions & 10 deletions .github/workflows/tests-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ jobs:
go-version-file: go.mod
check-latest: true

- name: Set Up Test
run: |
go install github.com/onsi/ginkgo/v2/ginkgo
go install github.com/onsi/gomega/matchers
- name: Run Units
run: make units

Expand All @@ -96,11 +91,6 @@ jobs:
go-version-file: go.mod
check-latest: true

- name: Set up Test
run: |
go install github.com/onsi/ginkgo/v2/ginkgo
go install github.com/onsi/gomega/matchers
- name: Get build-time dependencies
run: |
choco install --no-progress --limit-output -y make
Expand Down
35 changes: 20 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ fly-windows-units:
format: ## Run go fmt
go fmt ./...

install-test-deps: ## Install "global" dependencies needed to run tests
# Running `go install <pkg>` without a version specifier will use version specified in go.mod
# See https://go.dev/ref/mod#go-install
go install github.com/onsi/ginkgo/v2/ginkgo

integration-cleanup:
$(CURDIR)/bin/cleanup-integration

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

ise: integration-shared-experimental
integration-experimental-shared: integration-shared-experimental
integration-shared-experimental: build integration-cleanup ## Run experimental integration tests that are shared between v6 and v7
integration-shared-experimental: build install-test-deps integration-cleanup ## Run experimental integration tests that are shared between v6 and v7
$(ginkgo_int) -nodes $(NODES) integration/shared/experimental

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

ig: integration-global
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

isg: integration-shared-global
integration-global-shared: integration-shared-global
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
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
$(ginkgo_int) integration/shared/global

ivg: integration-versioned-global
integration-global-versioned: integration-versioned-global
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
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
$(ginkgo_int) integration/v7/global

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

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

integration-performance: build integration-cleanup integration-shared-performance

isp: integration-shared-performance
integration-performance-shared: integration-shared-performance
integration-shared-performance: build integration-cleanup
integration-shared-performance: build install-test-deps integration-cleanup
$(ginkgo_int) integration/shared/performance

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

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

ip: integration-push
integration-push: build integration-cleanup ## Run all push-related integration tests
integration-push: build install-test-deps integration-cleanup ## Run all push-related integration tests
$(ginkgo_int) -nodes $(NODES) integration/v7/push

integration-selfcontained: build
integration-selfcontained: build install-test-deps
$(ginkgo_int) -nodes $(NODES) integration/v7/selfcontained

integration-tests: build integration-cleanup integration-isolated integration-push integration-global integration-selfcontained ## Run all isolated, push, selfcontained, and global integration tests
Expand All @@ -137,7 +142,7 @@ i: integration-tests-full
integration-full-tests: integration-tests-full
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

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

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

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

ifeq ($(OS),Windows_NT)
units-non-plugin:
units-non-plugin: install-test-deps
@rm -f $(wildcard fixtures/plugins/*.exe)
@ginkgo version
CF_HOME=$(CURDIR)/fixtures CF_USERNAME="" CF_PASSWORD="" $(ginkgo_units) \
-skip-package integration,cf\ssh,plugin,cf\actors\plugin,cf\commands\plugin,cf\actors\plugin,util\randomword
CF_HOME=$(CURDIR)/fixtures $(ginkgo_units) -flake-attempts 3 cf/ssh
else
units-non-plugin:
units-non-plugin: install-test-deps
@rm -f $(wildcard fixtures/plugins/*.exe)
@ginkgo version
CF_HOME=$(CURDIR)/fixtures CF_USERNAME="" CF_PASSWORD="" $(ginkgo_units) \
Expand All @@ -225,7 +230,7 @@ version: ## Print the version number of what would be built
@echo $(CF_BUILD_VERSION)+$(CF_BUILD_SHA).$(CF_BUILD_DATE)

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

Expand Down

0 comments on commit 3eaa855

Please sign in to comment.