Skip to content

CNF-23389: mockgen deprecated: use uber-go/mock instead#194

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

CNF-23389: mockgen deprecated: use uber-go/mock instead#194
sebrandon1 wants to merge 1 commit into
openshift:mainfrom
sebrandon1:mockgen_depreciation

Conversation

@sebrandon1
Copy link
Copy Markdown
Member

@sebrandon1 sebrandon1 commented Nov 13, 2025

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 the mocking/testing dependency to a newer implementation to improve test compatibility.
    • Adjusted test imports to align with the updated mocking library; no test logic changed.
    • Minor import formatting cleanup to improve code readability.

@openshift-ci openshift-ci Bot requested review from mpatlasov and rhrmo November 13, 2025 21:18
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Nov 13, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sebrandon1
Once this PR has been reviewed and has the lgtm label, please assign dfajmon 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 14, 2025
@sebrandon1 sebrandon1 force-pushed the mockgen_depreciation branch from d72ca5f to f75ecbe Compare December 2, 2025 17:02
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 2, 2025
@sebrandon1 sebrandon1 force-pushed the mockgen_depreciation branch from f75ecbe to eb72bcd Compare January 16, 2026 17:36
@sebrandon1 sebrandon1 force-pushed the mockgen_depreciation branch from 470795a to 75ae47f Compare March 20, 2026 19:44
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 20, 2026

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: d80216d6-96e8-4e02-861a-946dd84aa5d5

📥 Commits

Reviewing files that changed from the base of the PR and between 1196dc1 and 592c703.

⛔ Files ignored due to path filters (11)
  • go.sum is excluded by !**/*.sum
  • vendor/github.com/golang/mock/CONTRIBUTORS 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/modules.txt is excluded by !**/vendor/**, !vendor/**
📒 Files selected for processing (7)
  • go.mod
  • pkg/check/datastore_test.go
  • pkg/check/mock/authmanager_generated.go
  • pkg/check/node_cbt_test.go
  • pkg/check/node_cluster_permissions_test.go
  • pkg/check/permissions_test.go
  • pkg/operator/operatorclient.go
✅ Files skipped from review due to trivial changes (2)
  • pkg/operator/operatorclient.go
  • pkg/check/datastore_test.go

Walkthrough

This PR replaces the gomock dependency with go.uber.org/mock in go.mod and updates gomock import paths across test files and a generated mock; a minor blank-line import formatting change was also applied.

Changes

Mock Framework Migration

Layer / File(s) Summary
Dependency Declaration
go.mod
Removed github.com/golang/mock v1.6.0 and added go.uber.org/mock v0.6.0 in the require block.
Import Path & Generated Mock Updates
pkg/check/datastore_test.go, pkg/check/node_cbt_test.go, pkg/check/node_cluster_permissions_test.go, pkg/check/permissions_test.go, pkg/check/mock/authmanager_generated.go, pkg/operator/operatorclient.go
Updated gomock import statements from github.com/golang/mock/gomock to go.uber.org/mock/gomock in tests and generated mock; consolidated parameter types to any in one generated recorder signature; added a blank line inside an import block in operatorclient.go.

🎯 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 concisely summarizes the main change: migrating from the deprecated golang/mock to uber-go/mock, which is directly supported by all file changes in the pull request.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 All test names in modified test files are static and deterministic with no dynamic values, UUIDs, timestamps, pod/node names, or IPs in test titles.
Test Structure And Quality ✅ Passed PR only updates mock library imports from golang/mock to uber-go/mock. No test code modified. Repository uses standard Go testing, not Ginkgo. Import-only changes don't affect test quality.
Microshift Test Compatibility ✅ Passed This PR contains no new Ginkgo e2e tests. It only updates dependencies from golang/mock to go.uber.org/mock and updates imports in existing unit tests; the custom check does not apply.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This repository uses standard Go unit tests, not Ginkgo e2e tests. The SNO compatibility check applies only to Ginkgo e2e tests; this PR contains no new Ginkgo tests.
Topology-Aware Scheduling Compatibility ✅ Passed PR only updates test dependencies (golang/mock → go.uber.org/mock) and test import paths; no deployment manifests, operator scheduling logic, or topology-aware constraints are introduced.
Ote Binary Stdout Contract ✅ Passed PR only affects test imports and generated mock code. No process-level stdout writes; mock library exclusively used in test files, not in main() or init() contexts.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added in this PR. This is a unit test project using standard Go testing, not Ginkgo e2e tests. The PR only migrates mock library imports.

✏️ 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-23389: 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
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented Apr 30, 2026

@sebrandon1: This pull request references CNF-23389 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_depreciation branch from 75ae47f to 1196dc1 Compare May 6, 2026 13:15
@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

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 20, 2026

@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/okd-scos-e2e-aws-ovn d72ca5f link false /test okd-scos-e2e-aws-ovn

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.

@sebrandon1 sebrandon1 force-pushed the mockgen_depreciation branch from 1196dc1 to 592c703 Compare May 20, 2026 15:26
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.

3 participants