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
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 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
Copy link
Copy Markdown

codecov-commenter commented Nov 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.04%. Comparing base (25a5220) to head (34e2fe5).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #214   +/-   ##
=======================================
  Coverage   66.04%   66.04%           
=======================================
  Files          23       23           
  Lines        1546     1546           
=======================================
  Hits         1021     1021           
  Misses        447      447           
  Partials       78       78           
🚀 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
Copy link
Copy Markdown

coderabbitai Bot commented Feb 18, 2026

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 675c66ef-0d23-42cf-b49d-1bd759dd4f3a

📥 Commits

Reviewing files that changed from the base of the PR and between 3e7f0cd and 34e2fe5.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (3)
  • go.mod
  • pkg/util/test/mockgenerator/client/client.go
  • tools.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/util/test/mockgenerator/client/client.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • tools.go

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 and usage tips.

@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
Copy link
Copy Markdown

openshift-ci-robot commented Apr 30, 2026

@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
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 6, 2026

[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 smarthall 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 sebrandon1 force-pushed the mockgen_deprecation branch from 3e7f0cd to 34e2fe5 Compare May 29, 2026 15:00
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 29, 2026

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants