Skip to content

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

Open
ericahinkleRH wants to merge 3 commits into
openshift:masterfrom
ericahinkleRH:CCO-837-standalone
Open

CCO-837: Replace deprecated golang/mock with go.uber.org/mock#1069
ericahinkleRH wants to merge 3 commits 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 Google Cloud, OpenTelemetry, Envoy, and protocol-related dependencies.
    • Migrated the mocking framework used by the codebase to the maintained successor, including regenerated mocks.
  • Tests
    • Kept test behavior the same while updating mock wiring to match the new mocking dependency.
    • Adjusted a test helper for call ordering to remain compatible with the updated mocking types.

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

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 test files and generated mocks
- Fixed gomock.InOrder API change (requires []any instead of []*gomock.Call)
- Vendored new dependency

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@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. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a2a06832-5f90-44ec-af48-b4f834a72636

📥 Commits

Reviewing files that changed from the base of the PR and between 4fadd47 and 866edd0.

📒 Files selected for processing (1)
  • go.mod
🚧 Files skipped from review as they are similar to previous changes (1)
  • go.mod

Walkthrough

The module switches from legacy GoMock to Uber GoMock, updates generated mocks and tests to the new import path, adjusts one test helper type, and refreshes Go, gRPC, Envoy, Google, and OpenTelemetry dependencies.

Changes

GoMock migration and dependency refresh

Layer / File(s) Summary
Module dependency refresh
go.mod
Removes github.com/golang/mock, adds go.uber.org/mock, and updates Go, gRPC, Envoy, Google, and OpenTelemetry dependencies.
Generated mock imports
pkg/{aws,azure,gcp,ibmcloud}/mock/client_generated.go
Generated mocks now use Uber GoMock controller and call types.
Test mock imports and compatibility
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 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 clearly 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 changed file contains Ginkgo-style titles; the only new test-name text is a deterministic t.Run("count=%d") in a standard Go test.
Test Structure And Quality ✅ Passed Touched test files use standard testing, not Ginkgo; I found no Ginkgo imports, Eventually/Consistently, or fixture/timeout issues in the PR changes.
Microshift Test Compatibility ✅ Passed Only dependency/import and one slice-type change in existing tests; no added Ginkgo specs or MicroShift-unsupported APIs.
Single Node Openshift (Sno) Test Compatibility ✅ Passed Only go.mod changed in the actual diff; no Ginkgo/e2e tests were added, so SNO compatibility is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed Only go.mod changed (toolchain/deps); no manifests, controllers, or scheduling logic were modified, so topology-aware scheduling is not implicated.
Ote Binary Stdout Contract ✅ Passed Touched files are tests/mocks only; scans found no stdout writes, and the only init()s just set log levels. No main/TestMain/RunSpecs code changed.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Diff only updates test imports/generated mocks and one unit-test slice type; no Ginkgo e2e tests, IPv4 literals, or external network calls were added.
No-Weak-Crypto ✅ Passed No weak-crypto APIs or custom crypto were introduced; MD5/SHA1 mentions are only in vendored semconv comments/keys for cert fingerprints.
Container-Privileges ✅ Passed No container/K8s manifest files were changed, and no privileged/hostPID/hostNetwork/hostIPC/SYS_ADMIN/allowPrivilegeEscalation settings appeared in the diff.
No-Sensitive-Data-In-Logs ✅ Passed The PR only changes gomock imports and one []any test helper; touched files add no logs of secrets/tokens/PII, and existing t.Logf/t.Log calls are benign.
✨ 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

Updates grpc from v1.79.3 to v1.82.1 to resolve CVEs:
- SNYK-GOLANG-GOOGLEGOLANGORGGRPCINTERNALXDSRBAC-18172577
- SNYK-GOLANG-GOOGLEGOLANGORGGRPCINTERNALTRANSPORT-18172578

Also updates related dependencies for compatibility.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@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 (866edd0).

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.

Update Go toolchain from 1.26.4 to 1.26.5 to resolve security CVEs:
- SNYK-GOLANG-STDOS-17905377
- SNYK-GOLANG-STDCRYPTOTLS-17905406

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@ericahinkleRH: 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-hypershift 866edd0 link true /test e2e-hypershift
ci/prow/e2e-azure-manual-oidc 866edd0 link true /test e2e-azure-manual-oidc

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