Skip to content

refactor: migrate test suite from Ginkgo v1 to v2#554

Merged
tnikolova82 merged 4 commits intomasterfrom
ginkgo-v2
Mar 6, 2026
Merged

refactor: migrate test suite from Ginkgo v1 to v2#554
tnikolova82 merged 4 commits intomasterfrom
ginkgo-v2

Conversation

@ramonskie
Copy link
Contributor

@ramonskie ramonskie commented Mar 2, 2026

Summary

Migrates the test suite from Ginkgo v1 to v2.

Commits

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`. Run `go mod tidy` and `go mod vendor`.

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.

Files changed:

  • `src/go/finalize/finalize_test.go`
  • `src/go/hooks/appdynamics_test.go`
  • `src/go/supply/supply_test.go`

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`).

4. fix: resolve go vet non-constant format string errors
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`, `Logger.Debug`, and `Logger.BeginStep`. 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.

Files changed:

  • `src/go/finalize/finalize.go`
  • `src/go/hooks/appdynamics.go`
  • `src/go/supply/supply.go`

Verification

  • `./scripts/unit.sh` ✅
  • Zero `AfterEach` remaining in source ✅

Copy link
Contributor

@tnikolova82 tnikolova82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

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.
@tnikolova82 tnikolova82 merged commit 11be2e5 into master Mar 6, 2026
7 checks passed
@tnikolova82 tnikolova82 deleted the ginkgo-v2 branch March 6, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants