build(deps): bump mockery v2.53.6 → v3.7.2 - #9029
Open
DoDiODev wants to merge 1 commit into
Open
Conversation
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>
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
Bumps the mock-generation tool
github.com/vektra/mockeryfrom v2.53.6 tov3.7.2 at every install site (
backend/Makefile,backend/Dockerfile,backend/Dockerfile.local,devops/docker/lake-builder/Dockerfile), and addsthe 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
backend/Makefile(go-dep,mock)mockery@v2.53.6→@v3.7.2;mocktarget invokes the two new configs in a fixed orderbackend/Dockerfilev2.53.6→v3.7.2backend/Dockerfile.localdevops/docker/lake-builder/Dockerfilebackend/.mockery.core.yml(new)core/+helpers/pluginhelper/subtaskmeta/sorter, reproducing the v2 layout 1:1backend/.mockery.helpers.yml(new)helpers/interfacesWhy two configs?
helpers/unithelperimports the generatedmocks/core/...packages. Unlike v2, v3 loads sources viago/packageswith type-checking, so the core mocks must exist before the
helperstree is parsed. A single run across both trees fails after
rm -rf mockswith
could not import .../mocks/core/... (invalid package name). Bothconfigs 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 asmockdal "github.com/apache/incubator-devlake/mocks/core/dal"stay valid.Behavioral changes of v3 (documented for reviewers)
backend/mocks/is untracked (see.gitignore), so this diff is exactly the 6 files listed above — nothingunder
backend/mocks/is part of the PR.(e.g.
plugin.ApiAsyncCallback,plugin.ApiResourceHandler,plugin.SubTaskEntryPoint,api.DataConvertHandler,api.DsListRemoteScopes,errors.Option). None of them is referenced byany test (verified via
grepover all*_test.gofiles). Generated filecount drops from 77 to 64.
template-data.with-expecteris no longer a valid key: v3 alwaysgenerates
EXPECT()-style expectations — purely additive, no test changesneeded.
--recursive/--keeptree/--dir/--output/--namenolonger 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) onci/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/maintoolchain (git2go v33 / libgit2 1.3.x — this PR does not touchthat 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 failuresmake migration-script-lintOut of scope on purpose
backend/plugins/gitextractor/ libgit2 / git2go pinning — unrelated,covered by the separate build(deps): bump libgit2 1.3 → 1.5.0 and git2go v33 → v34 #9028 (Welle 4d).
backend/mocks/**— untracked, not part of the diff.Rollback
Revert the four version hunks, delete the two
.mockery.*.ymlfiles, restorethe
mocktarget's v2 CLI flags. No runtime, schema, or API impact —backend/mocks/is generated and untracked either way.