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
    • Switched the project’s mocking dependency to an alternative mock library and updated the associated module tooling.
    • Updated generated mocks and related test imports to use the new mocking package.
    • Adjusted tool-only mock generation references to match the new mock provider.

@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: ea687278-8851-4098-a340-a3c19953ef3e

📥 Commits

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

⛔ 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 (5)
  • tools.go
  • pkg/actuators/machine/machine_scope_test.go
  • pkg/actuators/machineset/controller_test.go
  • pkg/actuators/machine/actuator_test.go
  • pkg/actuators/client/mock/client_mock_generated.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • go.mod
  • pkg/actuators/machine/reconciler_test.go

Walkthrough

Replaces the mock dependency and related import paths from github.com/golang/mock to go.uber.org/mock across module, tooling, generated code, and tests.

Changes

Mock library migration

Layer / File(s) Summary
Module and tooling update
go.mod, tools.go
Replaced the github.com/golang/mock requirement with go.uber.org/mock v0.6.0 and updated the mockgen tool import to go.uber.org/mock/mockgen.
Generated mock import
pkg/actuators/client/mock/client_mock_generated.go
Updated the generated mock’s gomock import path to go.uber.org/mock/gomock.
Test gomock imports
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
Switched test imports from github.com/golang/mock/gomock to go.uber.org/mock/gomock in the affected actuator and machineset tests.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 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 title clearly summarizes the main change: replacing deprecated golang/mock/mockgen with go.uber.org/mock.
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 Modified test files only changed gomock imports; outlines show no It/Describe/Context/When titles, so no unstable Ginkgo names were introduced.
Test Structure And Quality ✅ Passed Only gomock import paths/tool dep were changed; no Ginkgo It blocks, setup/cleanup, waits, or assertions were modified.
Microshift Test Compatibility ✅ Passed Only gomock import-path updates and generated mock/tooling changes; the modified tests are testing.T unit tests with no new Ginkgo e2e cases or MicroShift-unsupported OpenShift APIs.
Single Node Openshift (Sno) Test Compatibility ✅ Passed Only gomock import-path/dependency updates; the touched tests are plain unit tests, with no new Ginkgo e2e tests or SNO-specific assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed Only mock dependency/import updates and test files changed; no deployment/controller scheduling logic or topology assumptions were introduced.
Ote Binary Stdout Contract ✅ Passed PASS: The PR only updates gomock import paths/dependency; no touched process-level code writes to stdout or configures logging there.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Only mock import paths and tool deps changed; no new Ginkgo e2e specs or IPv4/external-network assumptions were added.
No-Weak-Crypto ✅ Passed Touched files only swap gomock/mockgen imports to go.uber.org/mock; no MD5/SHA1/DES/RC4/3DES/ECB, custom crypto, or secret/token comparisons were added.
Container-Privileges ✅ Passed The PR only updates gomock deps/imports in Go files; no container/K8s manifests or privileged securityContext settings were added.
No-Sensitive-Data-In-Logs ✅ Passed Touched files only swap gomock imports/tool deps; no new log calls or secret-bearing log messages were added. Static test fixtures contain names only.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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?

@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch from 79036da to e881af0 Compare June 26, 2026 18:03
@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

@sebrandon1: The following tests 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/e2e-aws e881af0 link true /test e2e-aws
ci/prow/regression-clusterinfra-ibmcloud-ipi-mapi e881af0 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