Skip to content

build(deps): bump mockery v2.53.6 → v3.7.2 - #9029

Open
DoDiODev wants to merge 1 commit into
apache:mainfrom
DoDiODev:pr/wave4e-mockery
Open

build(deps): bump mockery v2.53.6 → v3.7.2#9029
DoDiODev wants to merge 1 commit into
apache:mainfrom
DoDiODev:pr/wave4e-mockery

Conversation

@DoDiODev

@DoDiODev DoDiODev commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Bumps the mock-generation tool github.com/vektra/mockery from v2.53.6 to
v3.7.2 at every install site (backend/Makefile, backend/Dockerfile,
backend/Dockerfile.local, devops/docker/lake-builder/Dockerfile), and adds
the two YAML configs mockery v3 requires instead of CLI flags.

Current pinning (before this PR) is mockery v2.53.6 (released 2024); v3.7.2 is
a rewrite with a new CLI/config surface (no code-generation logic changes for
the mocks actually used by this repo — see "Behavioral changes" below).

What changed

File Change
backend/Makefile (go-dep, mock) mockery@v2.53.6@v3.7.2; mock target invokes the two new configs in a fixed order
backend/Dockerfile install site v2.53.6v3.7.2
backend/Dockerfile.local ditto
devops/docker/lake-builder/Dockerfile ditto
backend/.mockery.core.yml (new) v3 config for core/ + helpers/pluginhelper/subtaskmeta/sorter, reproducing the v2 layout 1:1
backend/.mockery.helpers.yml (new) v3 config for the remaining helpers/ interfaces

Why two configs? helpers/unithelper imports the generated
mocks/core/... packages. Unlike v2, v3 loads sources via go/packages
with type-checking, so the core mocks must exist before the helpers
tree is parsed. A single run across both trees fails after rm -rf mocks
with could not import .../mocks/core/... (invalid package name). Both
configs reproduce the v2 layout 1:1 (dir: mocks/{{.InterfaceDirRelative}},
filename: {{.InterfaceName}}.go, pkgname: mocks,
structname: {{.InterfaceName}}, template: testify,
template-data.unroll-variadic: false), so existing imports such as
mockdal "github.com/apache/incubator-devlake/mocks/core/dal" stay valid.

Behavioral changes of v3 (documented for reviewers)

  1. No generated-code churn to review: backend/mocks/ is untracked (see
    .gitignore), so this diff is exactly the 6 files listed above — nothing
    under backend/mocks/ is part of the PR.
  2. Function-type mocking is gone, interfaces only: 13 mocks disappear
    (e.g. plugin.ApiAsyncCallback, plugin.ApiResourceHandler,
    plugin.SubTaskEntryPoint, api.DataConvertHandler,
    api.DsListRemoteScopes, errors.Option). None of them is referenced by
    any test (verified via grep over all *_test.go files). Generated file
    count drops from 77 to 64.
  3. template-data.with-expecter is no longer a valid key: v3 always
    generates EXPECT()-style expectations — purely additive, no test changes
    needed.
  4. CLI flags are gone: --recursive/--keeptree/--dir/--output/--name no
    longer exist; configuration is YAML-only, hence the two new config files.

Validation

CI equivalent (all green): the identical job matrix was run in a fork
workflow (fork-ci.yml) on ci/wave4e (this branch, unchanged) —
run 30904038830,
8/8 jobs successful: builder image, lint (go), unit-test, e2e (mysql),
migration-script-lint, config-ui, ASF license header, grafana dashboards.

Additionally, locally on macOS (arm64), against the unmodified
upstream/main toolchain (git2go v33 / libgit2 1.3.x — this PR does not touch
that pairing, see "Out of scope"):

  • make mock — regenerates all 64 mock files cleanly (rm -rf mocks +
    both configs in order)
  • go build ./... — compiles
  • ./scripts/unit-test-go.sh — 64 packages, exit 0, no failures
  • make migration-script-lint

Out of scope on purpose

Rollback

Revert the four version hunks, delete the two .mockery.*.yml files, restore
the mock target's v2 CLI flags. No runtime, schema, or API impact —
backend/mocks/ is generated and untracked either way.

Upgrade the mock generator from mockery v2.53.6 to v3.7.2 at every install
site (backend/Makefile, backend/Dockerfile, backend/Dockerfile.local,
devops/docker/lake-builder/Dockerfile).

mockery v3 dropped the CLI flags used by the `mock` target and is configured
via YAML instead, so two config files are added:

- backend/.mockery.core.yml
- backend/.mockery.helpers.yml

They reproduce the exact layout produced by the previous v2 invocations
(--recursive --keeptree --dir=./<tree> --output=./mocks/<tree>
--unroll-variadic=false --name='.*'): backend/mocks/<src-dir>/<Interface>.go,
package `mocks`, un-prefixed mock struct names. Existing test imports such as
`mockdal "github.com/apache/incubator-devlake/mocks/core/dal"` therefore keep
working unchanged.

Two configs (instead of one) are required because `helpers/unithelper` imports
the generated `mocks/core/...` packages: unlike v2, v3 type-checks sources via
go/packages, so the core mocks must exist before the helpers tree can be
loaded. The `mock` target runs them in that order.

Note: v3 only generates mocks for interfaces, no longer for function types.
The affected mocks (e.g. plugin.ApiAsyncCallback, api.DataConvertHandler,
errors.Option) were not used by any test. `backend/mocks/` is gitignored, so
there is no generated-code churn in this diff.

Validation: `make mock`, `go build ./...` and `scripts/unit-test-go.sh`
(60 packages) all pass.

Signed-off-by: DoDiODev <DoDiDev@proton.me>
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.

1 participant