Skip to content

NO-JIRA: fix data race in TestEnqueueNodePoolsForCloudConfig - #9106

Closed
jparrill wants to merge 1 commit into
openshift:mainfrom
jparrill:fix-race-01
Closed

NO-JIRA: fix data race in TestEnqueueNodePoolsForCloudConfig#9106
jparrill wants to merge 1 commit into
openshift:mainfrom
jparrill:fix-race-01

Conversation

@jparrill

@jparrill jparrill commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • DeepCopy shared test objects before passing them to the fake client builder
  • Parallel subtests were sharing the same HostedControlPlane and NodePool pointers, and fake.NewClientBuilder().WithObjects() mutates ResourceVersion on the objects causing a data race
  • Pre-existing flaky test found while running the test suite with -race

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Improved test isolation by using independent copies of Kubernetes objects during setup.
    • Prevented test data from being unintentionally modified across test cases.

DeepCopy shared test objects before passing them to the fake client
builder. Parallel subtests were sharing the same HostedControlPlane
and NodePool pointers, and fake.NewClientBuilder().WithObjects()
mutates ResourceVersion on the objects causing a data race.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Juan Manuel Parrilla Madrid <jparrill@redhat.com>
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@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 24, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@jparrill: This pull request explicitly references no jira issue.

Details

In response to this:

Summary

  • DeepCopy shared test objects before passing them to the fake client builder
  • Parallel subtests were sharing the same HostedControlPlane and NodePool pointers, and fake.NewClientBuilder().WithObjects() mutates ResourceVersion on the objects causing a data race
  • Pre-existing flaky test found while running the test suite with -race

🤖 Generated with Claude Code

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.

@jparrill

Copy link
Copy Markdown
Contributor Author

/area testing

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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: 91a45fca-8671-4803-b6ae-791254f85ef0

📥 Commits

Reviewing files that changed from the base of the PR and between 144cca9 and ffb00d0.

📒 Files selected for processing (1)
  • hypershift-operator/controllers/nodepool/nodepool_controller_test.go

📝 Walkthrough

Walkthrough

TestEnqueueNodePoolsForCloudConfig now deep-copies each Kubernetes object from tc.objects into a new client.Object slice before constructing the fake client. The test uses these copies instead of the original input objects.

Possibly related PRs

  • openshift/hypershift#9095: Also updates TestEnqueueNodePoolsForCloudConfig to deep-copy objects before fake-client construction.

Suggested reviewers: bryan-cox, csrwng, sdminonne

🚥 Pre-merge checks | ✅ 11
✅ Passed checks (11 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: fixing a data race in TestEnqueueNodePoolsForCloudConfig.
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 PASS: All test titles in the changed file are static literals/table names; no dynamic values, timestamps, IDs, or title construction patterns were found.
Test Structure And Quality ✅ Passed PASS: the patch only deep-copies shared fixtures before fake client setup; the test remains single-purpose, has no waits/timeouts, and follows existing table-driven patterns.
Topology-Aware Scheduling Compatibility ✅ Passed Only a test changed to deep-copy fake-client inputs; no deployment/controller scheduling logic or topology-sensitive constraints were introduced.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Not applicable: the PR only deep-copies objects in a unit test; no new Ginkgo e2e tests, IPv4-only assumptions, or external connectivity were added.
No-Weak-Crypto ✅ Passed Only change deep-copies test objects before fake client creation; no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret comparison code was added.
Container-Privileges ✅ Passed Only change is a Go test file deep-copying fake client inputs; no container/K8s manifests or privilege settings were modified.
No-Sensitive-Data-In-Logs ✅ Passed The only code change deep-copies test objects before fake client creation; no new logging or sensitive literals were added.
✨ 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 added the area/testing Indicates the PR includes changes for e2e testing label Jul 24, 2026
@openshift-ci
openshift-ci Bot requested review from devguyio and sdminonne July 24, 2026 16:10
@openshift-ci openshift-ci Bot added the area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release label Jul 24, 2026
@jparrill

Copy link
Copy Markdown
Contributor Author

/close in favor of #9095

@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jparrill

The full list of commands accepted by this bot can be found here.

The pull request process is described 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed do-not-merge/needs-area labels Jul 24, 2026
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.51%. Comparing base (144cca9) to head (ffb00d0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9106   +/-   ##
=======================================
  Coverage   44.51%   44.51%           
=======================================
  Files         774      774           
  Lines       96997    96997           
=======================================
  Hits        43179    43179           
  Misses      50830    50830           
  Partials     2988     2988           
Flag Coverage Δ
cmd-support 38.39% <ø> (ø)
cpo-hostedcontrolplane 47.22% <ø> (ø)
cpo-other 45.25% <ø> (ø)
hypershift-operator 54.45% <ø> (ø)
other 32.64% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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

@bryan-cox

Copy link
Copy Markdown
Member

/close

@openshift-ci openshift-ci Bot closed this Jul 24, 2026
@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@bryan-cox: Closed this PR.

Details

In response to this:

/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release area/testing Indicates the PR includes changes for e2e testing 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