Skip to content

CNF-23392: mockgen deprecated: use uber-go/mock instead#172

Open
sebrandon1 wants to merge 1 commit into
openshift:mainfrom
sebrandon1:mockgen_deprecation
Open

CNF-23392: mockgen deprecated: use uber-go/mock instead#172
sebrandon1 wants to merge 1 commit into
openshift:mainfrom
sebrandon1:mockgen_deprecation

Conversation

@sebrandon1

@sebrandon1 sebrandon1 commented Nov 13, 2025

Copy link
Copy Markdown
Member

https://github.com/golang/mock is marked as archived as of June 27, 2023. They recommend using go.uber.org/mock.

This PR attempts to change the dependency to one that is maintained.

Tracking issue: redhat-best-practices-for-k8s/telco-bot#45

Summary by CodeRabbit

  • Chores

    • Updated test dependency to a newer version.
  • Tests

    • Updated test imports and regenerated mocks; mock internal layouts adjusted (added unexported fields) with no behavioral or public API changes.

@openshift-ci

openshift-ci Bot commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign theobarberbany for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sebrandon1

Copy link
Copy Markdown
Member Author

/retest

@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch from 180d33d to cc2a743 Compare March 20, 2026 19:44
@coderabbitai

coderabbitai Bot commented Mar 20, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

This PR migrates the codebase from github.com/golang/mock to go.uber.org/mock by updating go.mod, changing gomock import paths in tests and generated client mocks, and regenerating mocks which add an internal isgomock struct{} field to some mock types.

Changes

Mock Framework Migration

Layer / File(s) Summary
Dependency update
go.mod
Removed github.com/golang/mock v1.6.0 and updated go.uber.org/mock from v0.4.0 to v0.6.0.
Import path updates
pkg/cloud/azure/actuators/machine/actuator_test.go, pkg/cloud/azure/actuators/machine/reconciler_test.go, pkg/cloud/azure/mock/client_generated.go
Swapped imports from github.com/golang/mock/gomock to go.uber.org/mock/gomock in tests and generated mock client file.
Generated mock struct updates
pkg/cloud/azure/services/resourceskus/mock_resourceskus/resourceskus_mock.go, pkg/util/cache/ttllru/mocks/ttllru_mock.go
Regenerated mocks now embed an unexported isgomock struct{} field in MockClient, MockCacher, and MockPeekingCacher.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main change: migrating from the deprecated golang/mock to uber-go/mock library.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PR does not modify any Ginkgo test names or titles; it only updates mock dependencies and imports, making the check inapplicable.
Test Structure And Quality ✅ Passed This PR only upgrades mock library dependencies and import paths; test files use standard Go testing (not Ginkgo), test logic is unchanged, so quality check is not applicable.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests added. PR only migrates mock library dependency from golang/mock to uber-go/mock with import/regeneration updates. Check is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This PR only migrates mock library dependencies and updates import paths; no new Ginkgo e2e tests are added, so SNO compatibility assessment does not apply.
Topology-Aware Scheduling Compatibility ✅ Passed PR only modifies test files, test imports, and mock dependencies. No deployment manifests, operator code, or scheduling constraints are introduced or modified.
Ote Binary Stdout Contract ✅ Passed PR updates mock dependency and both main.go files set flag.Set("logtostderr", "true") to redirect klog to stderr, preventing OTE stdout contract violations.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR contains no new Ginkgo e2e tests. Changes are limited to dependency updates and import path changes in existing unit tests, which are not in scope for the IPv6/disconnected network check.
No-Weak-Crypto ✅ Passed PR only updates mocking library dependencies; no weak cryptographic algorithms, custom crypto implementations, or non-constant-time comparisons are introduced.
Container-Privileges ✅ Passed PR updates Go mock dependencies only (golang/mock→go.uber.org/mock). No container/K8s manifests modified; no privilege configurations present or changed.
No-Sensitive-Data-In-Logs ✅ Passed PR updates mock dependencies (golang/mock → go.uber.org/mock). Review found no logging exposing passwords, tokens, API keys, PII, or sensitive credentials in the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@sebrandon1 sebrandon1 changed the title mockgen deprecated: use uber-go/mock instead CNF-23392: mockgen deprecated: use uber-go/mock instead Apr 30, 2026
@openshift-ci-robot

openshift-ci-robot commented Apr 30, 2026

Copy link
Copy Markdown

@sebrandon1: This pull request references CNF-23392 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

https://github.com/golang/mock is marked as archived as of June 27, 2023. They recommend using go.uber.org/mock.

This PR attempts to change the dependency to one that is maintained.

Tracking issue: redhat-best-practices-for-k8s/telco-bot#45

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 30, 2026
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 30, 2026
@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch from cc2a743 to 39877d7 Compare May 6, 2026 13:16
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 6, 2026
@sebrandon1

Copy link
Copy Markdown
Member Author

/retest

@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch from 39877d7 to 5b2655b Compare May 20, 2026 15:20
@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch 2 times, most recently from bcba908 to f0dca5f Compare June 9, 2026 16:35
@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch from f0dca5f to 640524e Compare June 15, 2026 17:20
@perdasilva

Copy link
Copy Markdown

/retest

@perdasilva

Copy link
Copy Markdown

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 22, 2026
@openshift-ci

openshift-ci Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

@sebrandon1: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants