Skip to content

migrate from uber-go/mock to vektra/mockery#212

Merged
majst01 merged 2 commits intomasterfrom
qwen-mock
Mar 4, 2026
Merged

migrate from uber-go/mock to vektra/mockery#212
majst01 merged 2 commits intomasterfrom
qwen-mock

Conversation

@chbmuc
Copy link
Contributor

@chbmuc chbmuc commented Mar 4, 2026

  • Replace go.uber.org/mock with github.com/vektra/mockery/v2 for mock generation
  • Update Makefile: replace mockgen target with mockery
  • Update go:generate directive in pkg/nftables/firewall.go
  • Regenerate mocks using mockery (now uses github.com/stretchr/testify/mock)
  • Update test imports and mock usage from gomock API to testify/mock API

Mock API changes:

  • Mock class: MockFQDNCache -> FQDNCache
  • Constructor: NewMockFQDNCache(ctrl) -> NewFQDNCache(t)
  • Matchers: gomock.Any() -> mock.Anything
  • Expectations: .EXPECT().Method() -> .On("Method")

Description

This is a test for automatic test refactoring with Qwen3.5-122B

- Replace go.uber.org/mock with github.com/vektra/mockery/v2 for mock generation
- Update Makefile: replace mockgen target with mockery
- Update go:generate directive in pkg/nftables/firewall.go
- Regenerate mocks using mockery (now uses github.com/stretchr/testify/mock)
- Update test imports and mock usage from gomock API to testify/mock API

Mock API changes:
- Mock class: MockFQDNCache -> FQDNCache
- Constructor: NewMockFQDNCache(ctrl) -> NewFQDNCache(t)
- Matchers: gomock.Any() -> mock.Anything
- Expectations: .EXPECT().Method() -> .On("Method")
@chbmuc chbmuc requested a review from a team as a code owner March 4, 2026 12:01
@metal-robot metal-robot bot added this to Development Mar 4, 2026
The test was using mock.Anything for both GetSetsForFQDN calls, causing
both expectations to match every call and return the same values. Now
matches on the actual FQDNSelector values (MatchName and MatchPattern)
to properly test the different return values for IPv4 and IPv6 sets.
@chbmuc chbmuc changed the title DRAFT: migrate from uber-go/mock to vektra/mockery migrate from uber-go/mock to vektra/mockery Mar 4, 2026
@majst01 majst01 merged commit b2e7436 into master Mar 4, 2026
2 checks passed
@majst01 majst01 deleted the qwen-mock branch March 4, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants