Skip to content

CNF-23393: mockgen deprecated: use uber-go/mock instead#214

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

CNF-23393: mockgen deprecated: use uber-go/mock instead#214
sebrandon1 wants to merge 1 commit into
openshift:masterfrom
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 dependency versions in module declarations to rely on the newer mock framework release for improved maintenance and compatibility.
    • Migrated the mocking tool to an actively maintained alternative and updated related import references across the codebase to reflect the new package.

@openshift-ci openshift-ci Bot requested review from a7vicky and bmeng November 13, 2025 20:50
@codecov-commenter

codecov-commenter commented Nov 13, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 27.77778% with 52 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.03%. Comparing base (cdb433e) to head (f78b765).

Files with missing lines Patch % Lines
pkg/util/test/generated/mocks/client/cr-client.go 27.77% 47 Missing and 5 partials ⚠️

❌ Your patch status has failed because the patch coverage (27.77%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #214   +/-   ##
=======================================
  Coverage   65.03%   65.03%           
=======================================
  Files          23       23           
  Lines        1570     1570           
=======================================
  Hits         1021     1021           
  Misses        471      471           
  Partials       78       78           
Files with missing lines Coverage Δ
...test/generated/mocks/ocmagenthandler/interfaces.go 100.00% <ø> (ø)
pkg/util/test/generated/mocks/client/cr-client.go 33.98% <27.77%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tkong-redhat

Copy link
Copy Markdown
Contributor

/retest

@tkong-redhat

Copy link
Copy Markdown
Contributor

validation failed. Need update the base image

@coderabbitai

coderabbitai Bot commented Feb 18, 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

Replace direct dependency on github.com/golang/mock with go.uber.org/mock (v0.6.0) and update mockgen import paths in code and tools to use go.uber.org/mock/mockgen.

Changes

Mock Module Migration

Layer / File(s) Summary
Direct dependency updates
go.mod
Removed github.com/golang/mock v1.6.0 and upgraded go.uber.org/mock to v0.6.0.
Import path updates
pkg/util/test/mockgenerator/client/client.go, tools.go
Changed imports from github.com/golang/mock/mockgen/.../model to go.uber.org/mock/mockgen/.../model.

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 PR title clearly and specifically describes the main change: migrating from the deprecated github.com/golang/mock to go.uber.org/mock, which aligns with all files modified in the changeset.
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 updates mock dependencies only; no test files modified. All 211 Ginkgo test titles are static with no dynamic content like fmt.Sprintf, UUIDs, timestamps, or pod names.
Test Structure And Quality ✅ Passed PR migrates mock library dependencies only; no Ginkgo test code was added, modified, or changed, making the test structure quality check inapplicable.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests added in this PR. Changes are limited to updating mock generation tool dependencies from golang/mock to go.uber.org/mock.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR only updates mock library dependencies and imports; no new Ginkgo e2e tests (It(), Describe(), Context(), When()) are added, so the SNO test compatibility check does not apply.
Topology-Aware Scheduling Compatibility ✅ Passed PR only updates mock library dependencies (go.mod, tools.go, client.go). No deployment manifests, operator code, or controllers were modified.
Ote Binary Stdout Contract ✅ Passed PR changes only involve dependency updates to build tools (tools.go with +build tools tag) and test code generation (client.go), with no process-level stdout writes added.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR does not add new Ginkgo e2e tests; changes are mock dependency updates (go.mod, tools.go, client.go imports) only. Check is not applicable.
No-Weak-Crypto ✅ Passed No weak crypto, custom crypto implementations, or non-constant-time secret comparisons found. PR only updates mock library dependencies and imports.
Container-Privileges ✅ Passed PR updates Go dependencies for mockgen library only; no changes to container security settings, Kubernetes manifests with privileged containers, or host namespace configurations.
No-Sensitive-Data-In-Logs ✅ Passed PR contains only dependency updates and import path changes (golang/mock → go.uber.org/mock) with no logging statements added or modified, eliminating any risk of exposing sensitive data in logs.

✏️ 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.

@sebrandon1

Copy link
Copy Markdown
Member Author

/retest

@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch from 814e018 to 028fb07 Compare March 20, 2026 19:44
@sebrandon1 sebrandon1 changed the title mockgen deprecated: use uber-go/mock instead CNF-23393: 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-23393 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 028fb07 to 3e7f0cd 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 sebrandon1 force-pushed the mockgen_deprecation branch from 3e7f0cd to 34e2fe5 Compare May 29, 2026 15:00
@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch 2 times, most recently from ce75e33 to d1e0439 Compare June 9, 2026 16:35
@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch from d1e0439 to 55e9cfa Compare June 15, 2026 17:20
@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch from 55e9cfa to 40560c2 Compare July 6, 2026 16:15
@openshift-ci

openshift-ci Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

[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 jmelis 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-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 8, 2026
Migrate from the archived github.com/golang/mock to the maintained
fork go.uber.org/mock. Regenerate all mock files with the new mockgen.
@sebrandon1 sebrandon1 force-pushed the mockgen_deprecation branch from 40560c2 to f78b765 Compare July 8, 2026 20:52
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 8, 2026
@openshift-ci

openshift-ci Bot commented Jul 8, 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/validate f78b765 link true /test validate

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