Skip to content

CNF-23394: mockgen deprecated: use uber-go/mock instead#73

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

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

Conversation

@sebrandon1

@sebrandon1 sebrandon1 commented Nov 14, 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
    • Replaced the project's mocking toolchain with an alternative mock library and updated generated test mocks accordingly.
    • Adjusted test tooling references and imports to align with the new mock provider to ensure consistent test generation and execution.

@openshift-ci openshift-ci Bot requested review from RadekManak and nrb November 14, 2025 15:57
@openshift-ci

openshift-ci Bot commented Nov 14, 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 radekmanak 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

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 18, 2025
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 19, 2025
@sebrandon1

Copy link
Copy Markdown
Member Author

/retest

1 similar comment
@sebrandon1

Copy link
Copy Markdown
Member Author

/retest

@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch from 13eb179 to 2071c29 Compare March 20, 2026 19:44
@coderabbitai

coderabbitai Bot commented Mar 20, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 08c40f99-cbb4-41b0-b86e-a8a208b6d679

📥 Commits

Reviewing files that changed from the base of the PR and between 05a4657 and 79036da.

⛔ Files ignored due to path filters (23)
  • go.sum is excluded by !**/*.sum
  • vendor/github.com/golang/mock/CONTRIBUTORS is excluded by !**/vendor/**, !vendor/**
  • vendor/github.com/golang/mock/mockgen/reflect.go is excluded by !**/vendor/**, !vendor/**
  • vendor/github.com/golang/mock/mockgen/version.1.11.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/AUTHORS is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/LICENSE is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/gomock/call.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/gomock/callset.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/gomock/controller.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/gomock/doc.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/gomock/matchers.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/gomock/string.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/mockgen/archive.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/mockgen/deprecated.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/mockgen/generic.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/mockgen/gob.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/mockgen/mockgen.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/mockgen/model/model.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/mockgen/model/model_gotypes.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/mockgen/package_mode.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/mockgen/parse.go is excluded by !**/vendor/**, !vendor/**
  • vendor/go.uber.org/mock/mockgen/version.go is excluded by !**/vendor/**, !vendor/**
  • vendor/modules.txt is excluded by !**/vendor/**, !vendor/**
📒 Files selected for processing (7)
  • go.mod
  • pkg/actuators/client/mock/client_mock_generated.go
  • pkg/actuators/machine/actuator_test.go
  • pkg/actuators/machine/machine_scope_test.go
  • pkg/actuators/machine/reconciler_test.go
  • pkg/actuators/machineset/controller_test.go
  • tools.go
✅ Files skipped from review due to trivial changes (2)
  • pkg/actuators/machineset/controller_test.go
  • tools.go

Walkthrough

Replaces the mocking library from github.com/golang/mock to go.uber.org/mock across the repo: updates go.mod, the tools blank import for mockgen, the generated mock file import, and gomock imports in several test files.

Changes

Mock library migration

Layer / File(s) Summary
Module / Tooling
go.mod, tools.go
Replaced github.com/golang/mock requirement with go.uber.org/mock v0.6.0; changed blank tool import for mockgen to go.uber.org/mock/mockgen.
Generated mocks
pkg/actuators/client/mock/client_mock_generated.go
Updated import path for gomock from github.com/golang/mock/gomock to go.uber.org/mock/gomock.
Test wiring
pkg/actuators/machine/actuator_test.go, pkg/actuators/machine/machine_scope_test.go, pkg/actuators/machine/reconciler_test.go, pkg/actuators/machineset/controller_test.go
Replaced gomock import paths in test files to go.uber.org/mock/gomock; test usage (controllers, matchers, expectations) unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 12
✅ Passed checks (12 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: migrating from the deprecated golang/mock to the maintained go.uber.org/mock alternative.
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 only updates mock library imports from golang/mock to uber-go/mock; does not introduce any Ginkgo tests or dynamic test names. No test names, declarations, or logic were modified.
Test Structure And Quality ✅ Passed PR only changes mock library import paths in standard Go tests and go.mod/tools.go. No Ginkgo test code (It/Describe blocks) was modified, so test quality check does not apply.
Microshift Test Compatibility ✅ Passed PR contains no new Ginkgo e2e tests. It only updates mock library dependencies and import paths in existing standard Go unit tests; no test logic or MicroShift-incompatible APIs are introduced.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR only updates mock dependency imports in existing standard unit tests; no new Ginkgo e2e tests (It/Describe/Context/When) are added, so SNO compatibility check does not apply.
Topology-Aware Scheduling Compatibility ✅ Passed PR only updates test dependencies and imports (golang/mock → go.uber.org/mock); no scheduling constraints, deployment manifests, or topology-aware code changes detected.
Ote Binary Stdout Contract ✅ Passed PR updates mock library imports from golang/mock to go.uber.org/mock. No process-level stdout writes introduced in main, init, or suite-level code.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No Ginkgo e2e tests added. PR only updates mock dependencies and imports. Check only applies when new Ginkgo tests are added.

✏️ 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-23394: mockgen deprecated: use uber-go/mock instead Apr 30, 2026
@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-robot

openshift-ci-robot commented Apr 30, 2026

Copy link
Copy Markdown

@sebrandon1: This pull request references CNF-23394 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 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 2071c29 to 05a4657 Compare May 6, 2026 13:17
@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 05a4657 to 79036da Compare May 20, 2026 15:24
@perdasilva

Copy link
Copy Markdown

/retest

@perdasilva

Copy link
Copy Markdown

@sebrandon1 is this still relevant?

@openshift-ci

openshift-ci Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

@sebrandon1: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/regression-clusterinfra-ibmcloud-ipi-mapi 79036da link false /test regression-clusterinfra-ibmcloud-ipi-mapi

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants