Skip to content

Add e2e tests for NodePool OSImageStream (v1 and v2)#9033

Draft
sdminonne wants to merge 2 commits into
openshift:mainfrom
sdminonne:e2ev2-nodepool-osimagestream-tests
Draft

Add e2e tests for NodePool OSImageStream (v1 and v2)#9033
sdminonne wants to merge 2 commits into
openshift:mainfrom
sdminonne:e2ev2-nodepool-osimagestream-tests

Conversation

@sdminonne

@sdminonne sdminonne commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds e2e tests for the NodePool OSImageStream (OSStreams feature gate) to both v1 and v2 test frameworks
  • v2 (test/e2e/v2/tests/nodepool_osimagestream_test.go): runs in e2e-v2-aws CI job
  • v1 (test/e2e/nodepool_osimagestream_test.go): runs in e2e-aws-4-22 and e2e-aks-4-22 CI jobs

Test scenarios

# Scenario OCP versions Creates nodes?
1 Explicit rhel-10 rejected < 5.0 only No (0 replicas)
2 Explicit rhel-9 accepted, status reports rhel-9 All Yes (1 replica)
3 Default NodePool reports rhel-9 in status All No (reads existing)

Feature gate handling

  • Tests 1 and 2 detect the OSStreams feature gate at NodePool creation time: if the API server rejects the osImageStream field, the test skips with a diagnostic message
  • Test 3 probes the existing default NodePool's status.osImageStream — if it is empty, the feature gate is not enabled and the test skips immediately instead of polling for the full 5-minute timeout
  • Test 3 also skips if the default NodePool explicitly sets spec.osImageStream, since the test validates default resolution behavior

v1 subtest execution

v1 subtests run sequentially (no t.Parallel()) because they share the parent test's ctx within NewHypershiftTest.Execute.

TODO(OSStreams): The default OS stream is currently hardcoded to rhel-9 for all OCP versions. When the hardcoding is removed and OCP >= 5.0 defaults to rhel-10, update test 3 to expect rhel-10 on >= 5.0.

Test plan

  • make e2ev2 compiles without errors
  • go test -tags e2e -c ./test/e2e/ compiles without errors
  • go vet passes for both frameworks
  • make verify passes
  • Dry run lists all 3 v2 tests with --ginkgo.label-filter="nodepool-osimagestream"
  • v2 tests 2 and 3 run (not skip) on OCP >= 5.0 in e2e-v2-aws
  • Run against OCP < 5.0 cluster with OSStreams feature gate enabled

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Added end-to-end coverage for NodePool OS image stream configuration.
    • Verified explicit RHEL 9 image stream selection and status reporting.
    • Verified the default image stream resolves to RHEL 9.
    • Added validation for rejecting RHEL 10 image streams on unsupported platform versions.
    • Tests automatically skip when the feature is unavailable in the environment.

@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 openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 17, 2026
@openshift-ci

openshift-ci Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci Bot added do-not-merge/needs-area area/testing Indicates the PR includes changes for e2e testing labels Jul 17, 2026
@openshift-ci

openshift-ci Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

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

Walkthrough

Adds legacy and e2e v2 tests for NodePool.spec.osImageStream and status.osImageStream. The tests verify RHEL 10 rejection below OCP 5.0, explicit RHEL 9 acceptance and provisioning, and default NodePool reporting of RHEL 9. Tests skip when the management API lacks osImageStream support.

Sequence Diagram(s)

sequenceDiagram
  participant E2ETest
  participant ManagementCluster
  participant NodePoolController
  participant HostedClusterGuestClient
  E2ETest->>ManagementCluster: Create NodePool with osImageStream
  ManagementCluster->>NodePoolController: Reconcile NodePool
  NodePoolController-->>ManagementCluster: Update ValidMachineConfig and status
  E2ETest->>HostedClusterGuestClient: Wait for node readiness
  HostedClusterGuestClient-->>E2ETest: Return ready nodes
  E2ETest->>ManagementCluster: Read status.osImageStream.name
Loading

Possibly related PRs

🚥 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 clearly matches the main change: adding NodePool OSImageStream e2e tests in both v1 and v2 frameworks.
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 All Ginkgo titles are fixed strings; no generated names, timestamps, UUIDs, node/namespace/IP values appear in test titles.
Test Structure And Quality ✅ Passed Tests use bounded Eventually timeouts, DeferCleanup/t.Cleanup for NodePool deletes, and follow existing v1/v2 suite patterns without orphaned resources.
Topology-Aware Scheduling Compatibility ✅ Passed Only e2e tests were added; they create NodePools but add no affinity, nodeSelectors, PDBs, spread constraints, or control-plane assumptions.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The new Ginkgo tests only create/read NodePool resources and wait on cluster-internal status; no IPv4 literals, IP parsing, host URL building, or public internet access found.
No-Weak-Crypto ✅ Passed No MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret/token comparisons appear in the changed files; only OSImageStream enum equality checks.
Container-Privileges ✅ Passed Changed files are pure Go e2e tests; diff search found no privileged/hostNetwork/hostPID/hostIPC/SYS_ADMIN/allowPrivilegeEscalation settings.
No-Sensitive-Data-In-Logs ✅ Passed No passwords/tokens/PII patterns found; logs only mention NodePool names, status, and feature-gate errors.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
test/e2e/v2/tests/nodepool_osimagestream_test.go (2)

42-42: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use a plain Describe name and retain the Ginkgo label.

Remove the legacy string annotations; v2 tests use Label(...) for filtering.

Suggested change
-var _ = Describe("[sig-hypershift][Jira:Hypershift][Feature:NodePoolOSImageStream] NodePool OSImageStream", Label("lifecycle", "nodepool-osimagestream"), func() {
+var _ = Describe("NodePool OSImageStream", Label("lifecycle", "nodepool-osimagestream"), func() {

Based on learnings: v2 Ginkgo Describe names should remain plain and filtering should use Ginkgo labels.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/v2/tests/nodepool_osimagestream_test.go` at line 42, Update the
NodePool OSImageStream test’s Describe declaration to use a plain descriptive
name without bracketed legacy annotations, while retaining the existing
Label("lifecycle", "nodepool-osimagestream") for filtering.

Source: Learnings


96-99: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Avoid shadowing the suite context in polling callbacks.

Rename each callback parameter (for example, pollCtx) so it does not hide the outer test context.

  • test/e2e/v2/tests/nodepool_osimagestream_test.go#L96-L99: rename callback ctx and use it for MgmtClient.Get.
  • test/e2e/v2/tests/nodepool_osimagestream_test.go#L170-L173: rename callback ctx and use it for MgmtClient.Get.
  • test/e2e/v2/tests/nodepool_osimagestream_test.go#L192-L195: rename callback ctx and use it for MgmtClient.Get.
  • test/e2e/v2/tests/nodepool_osimagestream_test.go#L233-L236: rename callback ctx and use it for MgmtClient.Get.

As per coding guidelines: “Avoid variable shadowing.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/v2/tests/nodepool_osimagestream_test.go` around lines 96 - 99,
Rename the polling callback parameter from ctx to a distinct name such as
pollCtx at all four sites in test/e2e/v2/tests/nodepool_osimagestream_test.go
(lines 96-99, 170-173, 192-195, and 233-236), and pass the renamed parameter to
testCtx.MgmtClient.Get so the outer suite context is not shadowed.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/v2/tests/nodepool_osimagestream_test.go`:
- Around line 227-249: Before waiting for the default NodePool status in the
test, verify that its OS image stream is unset and skip the test when it is
explicitly configured, preserving the requirement that this scenario exercises
default resolution. Add no mutation or setup to create the prerequisite; use the
existing defaultNP object and test framework skip mechanism around the NodePool
status assertion.

---

Nitpick comments:
In `@test/e2e/v2/tests/nodepool_osimagestream_test.go`:
- Line 42: Update the NodePool OSImageStream test’s Describe declaration to use
a plain descriptive name without bracketed legacy annotations, while retaining
the existing Label("lifecycle", "nodepool-osimagestream") for filtering.
- Around line 96-99: Rename the polling callback parameter from ctx to a
distinct name such as pollCtx at all four sites in
test/e2e/v2/tests/nodepool_osimagestream_test.go (lines 96-99, 170-173, 192-195,
and 233-236), and pass the renamed parameter to testCtx.MgmtClient.Get so the
outer suite context is not shadowed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 1dab87aa-99bc-497d-95c5-7dfa5c6e2642

📥 Commits

Reviewing files that changed from the base of the PR and between 3b49a4a and bca60d7.

📒 Files selected for processing (1)
  • test/e2e/v2/tests/nodepool_osimagestream_test.go

Comment thread test/e2e/v2/tests/nodepool_osimagestream_test.go
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.23%. Comparing base (3eefe36) to head (2da2fa6).
⚠️ Report is 40 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9033      +/-   ##
==========================================
+ Coverage   44.13%   44.23%   +0.09%     
==========================================
  Files         772      781       +9     
  Lines       96260    98553    +2293     
==========================================
+ Hits        42488    43595    +1107     
- Misses      50826    51906    +1080     
- Partials     2946     3052     +106     

see 38 files with indirect coverage changes

Flag Coverage Δ
cmd-support 38.32% <ø> (+0.05%) ⬆️
cpo-hostedcontrolplane 46.78% <ø> (+0.61%) ⬆️
cpo-other 45.22% <ø> (+<0.01%) ⬆️
hypershift-operator 54.14% <ø> (+0.04%) ⬆️
other 33.59% <ø> (+1.39%) ⬆️

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.

@sdminonne

Copy link
Copy Markdown
Contributor Author

/test e2e-v2-aws

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/nodepool_osimagestream_test.go`:
- Around line 84-90: Ensure all OSImageStream-related subtests, including the
default-status scenario, skip when the management cluster rejects the
osImageStream field instead of polling and failing. Reuse the existing error
detection around NodePool creation or perform a single capability check before
launching the three subtests, preserving the current skip message and failure
handling.
- Around line 28-29: Remove t.Parallel() from the affected subtests so they
execute before the parent test’s deferred cancel() invalidates the shared ctx.
Add the existing OSStreams feature-gate skip to testOSImageStreamDefaultStatus,
matching the skip behavior used by the other OSImageStream tests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: a6941345-647c-47c1-b985-4db905844830

📥 Commits

Reviewing files that changed from the base of the PR and between bca60d7 and d6712a5.

📒 Files selected for processing (1)
  • test/e2e/nodepool_osimagestream_test.go

Comment thread test/e2e/nodepool_osimagestream_test.go
Comment thread test/e2e/nodepool_osimagestream_test.go Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
test/e2e/v2/tests/nodepool_osimagestream_test.go (1)

230-231: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Verify that the default NodePool is actually unset before asserting default resolution.

The test claims "When no osImageStream is set" but does not verify this precondition. If the default NodePool explicitly sets osImageStream=rhel-9, the test passes without exercising default resolution. As per path instructions, non-lifecycle tests must skip when required preconditions are absent rather than proceeding.

Proposed fix
 		defaultNP := getDefaultNodePool(ctx, testCtx.MgmtClient, hc)
 		Expect(defaultNP).NotTo(BeNil(), "default NodePool should exist")
+		if defaultNP.Spec.OSImageStream.Name != "" {
+			Skip("default NodePool explicitly sets osImageStream=" + defaultNP.Spec.OSImageStream.Name)
+		}
 
 		// The default OS stream is currently hardcoded to rhel-9 for all OCP versions.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/v2/tests/nodepool_osimagestream_test.go` around lines 230 - 231, In
the test setup around getDefaultNodePool, verify that the default NodePool’s
osImageStream is unset before asserting default resolution. If the required
precondition is absent, skip the non-lifecycle test rather than continuing;
preserve the existing NotTo(BeNil()) assertion for confirming the NodePool
exists.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@test/e2e/v2/tests/nodepool_osimagestream_test.go`:
- Around line 230-231: In the test setup around getDefaultNodePool, verify that
the default NodePool’s osImageStream is unset before asserting default
resolution. If the required precondition is absent, skip the non-lifecycle test
rather than continuing; preserve the existing NotTo(BeNil()) assertion for
confirming the NodePool exists.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: be4d0bf2-d7b7-4408-add1-09f5e33242e2

📥 Commits

Reviewing files that changed from the base of the PR and between d6712a5 and 6182001.

📒 Files selected for processing (1)
  • test/e2e/v2/tests/nodepool_osimagestream_test.go

@sdminonne
sdminonne force-pushed the e2ev2-nodepool-osimagestream-tests branch 2 times, most recently from 1f644b4 to 736fc8d Compare July 17, 2026 14:24
@sdminonne sdminonne changed the title Add e2e v2 tests for NodePool OSImageStream on OCP < 5.0 Add e2e tests for NodePool OSImageStream (v1 and v2) Jul 17, 2026
@sdminonne

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/nodepool_osimagestream_test.go`:
- Around line 24-26: Remove the suite-level OCP version skip and add the same
guard at the start of testOSImageStreamRHEL10Rejection. Keep the RHEL 9 and
default-status tests running on OCP 5.0+, while skipping only the RHEL 10
rejection scenario there.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: f0c39885-fc16-48b9-8b0f-d354c4b8f08e

📥 Commits

Reviewing files that changed from the base of the PR and between 3b49a4a and 736fc8d.

📒 Files selected for processing (2)
  • test/e2e/nodepool_osimagestream_test.go
  • test/e2e/v2/tests/nodepool_osimagestream_test.go

Comment thread test/e2e/nodepool_osimagestream_test.go Outdated
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sdminonne
sdminonne force-pushed the e2ev2-nodepool-osimagestream-tests branch from 736fc8d to 92487fa Compare July 17, 2026 15:21
@sdminonne

Copy link
Copy Markdown
Contributor Author

/test e2e-v2-aws

@sdminonne

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-4-22

@openshift-ci

openshift-ci Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@sdminonne: 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/e2e-aws-4-22 92487fa link true /test e2e-aws-4-22

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.

Replace indirect feature gate detection (error string matching and
status field probing) with e2eutil.HasFieldInCRDSchema() to check
whether spec.osImageStream exists in the NodePool CRD schema. This
is more reliable since the +openshift:enable:FeatureGate=OSStreams
marker strips the field from the CRD entirely when disabled.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/testing Indicates the PR includes changes for e2e testing do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant