Skip to content

Replace gomock with mockery#1995

Merged
alexeykiselev merged 12 commits intomasterfrom
replace-gomock-with-mockery
Mar 12, 2026
Merged

Replace gomock with mockery#1995
alexeykiselev merged 12 commits intomasterfrom
replace-gomock-with-mockery

Conversation

@alexeykiselev
Copy link
Collaborator

No description provided.

Some mocks generated by moq replaced by mockery mocks.
Tests updated.
Private interface stateWrapper renamed to cleanerState.
Separate mock for this interface replaced with global state mock.
@alexeykiselev alexeykiselev requested a review from esuwu February 11, 2026 13:29
@alexeykiselev alexeykiselev added wip This is a WIP, should not be merged right away do not merge The PR is not ready to be merged labels Feb 11, 2026
@alexeykiselev alexeykiselev removed wip This is a WIP, should not be merged right away do not merge The PR is not ready to be merged labels Feb 13, 2026
Comment on lines +402 to +403
unsetMockCalls(&e.me.Mock, "libVersion")
unsetMockCalls(&e.me.Mock, "setLibVersion")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggest to add tests for these methods names (similar above and below). Can be helpful in renaming/refactoring process. Tests can be written with reflect package, I guess.

Comment on lines +4489 to +4494
var aliasCalls []mock.Call
for _, c := range env.ms.Calls {
if c.Method == "NewestAddrByAlias" {
aliasCalls = append(aliasCalls, c)
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be replaced to countMockCalls

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually this check can be safely removed. All calls already added to expectations, and expectations checks registered in NewMockEnvironment function.
I tried to add one more expectation of this call here and test failed.

@alexeykiselev alexeykiselev merged commit c846584 into master Mar 12, 2026
21 checks passed
@alexeykiselev alexeykiselev deleted the replace-gomock-with-mockery branch March 12, 2026 15:30
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