Skip to content

CCO-837: Replace deprecated golang/mock with go.uber.org/mock - #1069

Open
ericahinkleRH wants to merge 1 commit into
openshift:masterfrom
ericahinkleRH:CCO-837-standalone
Open

CCO-837: Replace deprecated golang/mock with go.uber.org/mock#1069
ericahinkleRH wants to merge 1 commit into
openshift:masterfrom
ericahinkleRH:CCO-837-standalone

Conversation

@ericahinkleRH

@ericahinkleRH ericahinkleRH commented Jul 23, 2026

Copy link
Copy Markdown

Summary

Replace deprecated golang/mock with go.uber.org/mock as the maintained fork.

The golang/mock repository is no longer maintained and recommends migrating to go.uber.org/mock.

Changes

  • Updated go.mod dependency from golang/mock v1.7.0-rc.1 to go.uber.org/mock v0.6.0
  • Replaced import paths in all test files and generated mocks
  • Fixed gomock.InOrder API change (requires []any instead of []*gomock.Call)
  • Vendored new dependency

Testing

  • Unit tests pass
  • All imports updated correctly
  • No changes to production code (mocks only used in tests)

Jira

https://redhat.atlassian.net/browse/CCO-837

Notes

This PR is independent and does NOT depend on CCO-834 (K8s 1.36 upgrade).

Summary by CodeRabbit

  • Chores
    • Updated the Go toolchain target and refreshed several Google Cloud, OpenTelemetry, Envoy, and protocol-related dependencies.
    • Migrated the project’s mocking library to a maintained successor and regenerated mocks accordingly.
  • Tests
    • Updated tests and shared test helpers to use the new mocking library types while preserving existing test behavior.
    • Adjusted mock call-ordering support to remain compatible after the migration.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 23, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@ericahinkleRH: This pull request references CCO-837 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:

Summary

Replace deprecated golang/mock with go.uber.org/mock as the maintained fork.

The golang/mock repository is no longer maintained and recommends migrating to go.uber.org/mock.

Changes

  • Updated go.mod dependency from golang/mock v1.7.0-rc.1 to go.uber.org/mock v0.6.0
  • Replaced import paths in all test files and generated mocks
  • Fixed gomock.InOrder API change (requires []any instead of []*gomock.Call)
  • Vendored new dependency

Testing

  • Unit tests pass
  • All imports updated correctly
  • No changes to production code (mocks only used in tests)

Jira

https://redhat.atlassian.net/browse/CCO-837

Notes

This PR is independent and does NOT depend on CCO-834 (K8s 1.36 upgrade).

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.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉


Walkthrough

The module migrates from legacy GoMock to Uber GoMock, updates generated mocks and tests, changes one ordered-call helper type, and refreshes Go, gRPC, Envoy, Google, protobuf, and OpenTelemetry dependencies.

Changes

GoMock migration and dependency refresh

Layer / File(s) Summary
Module and dependency updates
go.mod
Updates the Go toolchain, replaces github.com/golang/mock with go.uber.org/mock, and refreshes related dependencies.
Generated mock migration
pkg/{aws,azure,gcp,ibmcloud}/mock/client_generated.go
Generated client mocks now use Uber GoMock controller and call types.
Test migration and compatibility update
pkg/**/\*_test.go
Tests switch to Uber GoMock; the GCP utility test changes its ordered-call list to []any.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • openshift/ocm-agent#253: Also concerns Go module updates involving go.uber.org/mock and golang.org/x/oauth2.

Possibly related PRs

Suggested labels: approved

Suggested reviewers: dlom, jstuever

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: migrating from deprecated golang/mock to go.uber.org/mock.
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 No Ginkgo-style titles were added or changed; the touched files only contain static Go Test... functions and import/mock updates.
Test Structure And Quality ✅ Passed Changed tests only swap gomock imports and one slice type; no Ginkgo blocks or cluster ops were altered, so the quality criteria aren’t implicated.
Microshift Test Compatibility ✅ Passed PASS: The PR only updates gomock imports/deps and generated mocks; no new Ginkgo e2e tests or MicroShift-incompatible APIs were added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e specs were added; diff only updates gomock imports/generated mocks and one existing unit test helper change.
Topology-Aware Scheduling Compatibility ✅ Passed The PR only updates go.mod and test/mock files (gomock import swap plus one []any test helper); no manifests, controllers, or scheduling logic changed.
Ote Binary Stdout Contract ✅ Passed The diff only updates mock imports/dependencies and one test helper slice type; no process-level stdout writes or suite setup changes were added.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the commit only updates unit tests, generated mocks, and vendored deps, with no e2e-path changes or IPv4/network assumptions.
No-Weak-Crypto ✅ Passed Touched files only switch gomock imports and one slice type; no weak crypto, custom crypto, or new secret/token comparisons were introduced.
Container-Privileges ✅ Passed PR only changes Go module, tests, mocks, and vendored deps; no container/K8s manifests or privilege flags were touched.
No-Sensitive-Data-In-Logs ✅ Passed No added logging or sensitive-data-bearing output was introduced; the diff is limited to import/path, dependency, and mock updates.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci
openshift-ci Bot requested review from dlom and jstuever July 23, 2026 19:59
@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ericahinkleRH
Once this PR has been reviewed and has the lgtm label, please assign jstuever 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

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.30%. Comparing base (672b790) to head (4363f6f).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1069   +/-   ##
=======================================
  Coverage   47.30%   47.30%           
=======================================
  Files          97       97           
  Lines       12614    12614           
=======================================
  Hits         5967     5967           
  Misses       5987     5987           
  Partials      660      660           
Files with missing lines Coverage Δ
pkg/aws/mock/client_generated.go 49.74% <ø> (ø)
pkg/azure/mock/client_generated.go 70.08% <ø> (ø)
pkg/gcp/mock/client_generated.go 84.29% <ø> (ø)
pkg/ibmcloud/mock/client_generated.go 82.35% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ericahinkleRH

Copy link
Copy Markdown
Author

/retest-required

- Migrate from deprecated github.com/golang/mock to go.uber.org/mock
- Update go.mod dependencies
- Update toolchain to Go 1.26.5 for security fixes
- Update google.golang.org/grpc to v1.82.1 for security vulnerabilities
- Regenerate mocks using mockgen v0.5.0

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@ericahinkleRH

Copy link
Copy Markdown
Author

/test e2e-gcp-manual-oidc

1 similar comment
@ericahinkleRH

Copy link
Copy Markdown
Author

/test e2e-gcp-manual-oidc

@openshift-ci

openshift-ci Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

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

2 participants