Conversation
Upgrade github.com/onsi/ginkgo v1.16.5 -> v2 and update all import paths from github.com/onsi/ginkgo to github.com/onsi/ginkgo/v2.
Replace all AfterEach cleanup blocks with DeferCleanup calls co-located in BeforeEach/JustBeforeEach, following Ginkgo v2 idioms. Bare AfterEach at Describe-level are replaced with direct DeferCleanup calls in the Describe body.
Update ginkgo install path from github.com/onsi/ginkgo/ginkgo to github.com/onsi/ginkgo/v2/ginkgo so the correct CLI is used with v2 test suites.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR migrates the ruby-buildpack test suite from Ginkgo v1 to v2.
Commits
Commit 1 – migrate to ginkgo v2
Upgrade `github.com/onsi/ginkgo` v1.16.5 → v2 and update all import paths from `github.com/onsi/ginkgo` to `github.com/onsi/ginkgo/v2`. Runs `go mod tidy` and `go mod vendor` to bring in updated dependencies.
Commit 2 – refactor: migrate Ginkgo v1 AfterEach cleanup to v2 DeferCleanup
Replace all `AfterEach` cleanup blocks with `DeferCleanup` calls co-located in `BeforeEach`/`JustBeforeEach`, following Ginkgo v2 idioms. Bare `AfterEach` at `Describe`-level are replaced with direct `DeferCleanup` calls in the `Describe` body. `mockCtrl.Finish()` calls are removed (auto-handled by `GinkgoT()` in v2).
Files changed:
Commit 3 – fix: install ginkgo v2 CLI in unit test script
`scripts/.util/tools.sh` was installing the Ginkgo v1 CLI (`github.com/onsi/ginkgo/ginkgo`). Updated to install the v2 CLI (`github.com/onsi/ginkgo/v2/ginkgo`).
Commit 4 – fix: resolve go vet non-constant format string errors and bare DeferCleanup
Ginkgo v2 runs `go vet` before executing tests (v1 did not). This surfaced pre-existing non-constant format string errors in production source files where a variable was passed directly as the format argument to `Logger.Error`, `Logger.Warning`, and `Logger.Debug`. Fixed by adding `"%s"` as the format verb and passing the variable as the argument, or by inlining `fmt.Sprintf` calls directly into the logger call.
Additionally, two `DeferCleanup` calls in `supply_test.go` were placed directly in `Describe` container bodies (not inside a setup node). Ginkgo v2 panics at runtime when `DeferCleanup` is called outside a setup or subject node. Fixed by wrapping them in `BeforeEach`.
Files changed:
Verification