Add e2e tests for NodePool OSImageStream (v1 and v2)#9033
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sdminonne The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds legacy and e2e v2 tests for 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
Possibly related PRs
🚥 Pre-merge checks | ✅ 11✅ Passed checks (11 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
test/e2e/v2/tests/nodepool_osimagestream_test.go (2)
42-42: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse a plain
Describename 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
Describenames 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 valueAvoid 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 callbackctxand use it forMgmtClient.Get.test/e2e/v2/tests/nodepool_osimagestream_test.go#L170-L173: rename callbackctxand use it forMgmtClient.Get.test/e2e/v2/tests/nodepool_osimagestream_test.go#L192-L195: rename callbackctxand use it forMgmtClient.Get.test/e2e/v2/tests/nodepool_osimagestream_test.go#L233-L236: rename callbackctxand use it forMgmtClient.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
📒 Files selected for processing (1)
test/e2e/v2/tests/nodepool_osimagestream_test.go
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
/test e2e-v2-aws |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
test/e2e/nodepool_osimagestream_test.go
There was a problem hiding this comment.
♻️ Duplicate comments (1)
test/e2e/v2/tests/nodepool_osimagestream_test.go (1)
230-231: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winVerify 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
📒 Files selected for processing (1)
test/e2e/v2/tests/nodepool_osimagestream_test.go
1f644b4 to
736fc8d
Compare
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
test/e2e/nodepool_osimagestream_test.gotest/e2e/v2/tests/nodepool_osimagestream_test.go
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
736fc8d to
92487fa
Compare
|
/test e2e-v2-aws |
|
/test e2e-aws-4-22 |
|
@sdminonne: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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>
Summary
OSStreamsfeature gate) to both v1 and v2 test frameworkstest/e2e/v2/tests/nodepool_osimagestream_test.go): runs ine2e-v2-awsCI jobtest/e2e/nodepool_osimagestream_test.go): runs ine2e-aws-4-22ande2e-aks-4-22CI jobsTest scenarios
rhel-10rejectedrhel-9accepted, status reportsrhel-9rhel-9in statusFeature gate handling
OSStreamsfeature gate at NodePool creation time: if the API server rejects theosImageStreamfield, the test skips with a diagnostic messagestatus.osImageStream— if it is empty, the feature gate is not enabled and the test skips immediately instead of polling for the full 5-minute timeoutspec.osImageStream, since the test validates default resolution behaviorv1 subtest execution
v1 subtests run sequentially (no
t.Parallel()) because they share the parent test'sctxwithinNewHypershiftTest.Execute.Test plan
make e2ev2compiles without errorsgo test -tags e2e -c ./test/e2e/compiles without errorsgo vetpasses for both frameworksmake verifypasses--ginkgo.label-filter="nodepool-osimagestream"e2e-v2-awsOSStreamsfeature gate enabled🤖 Generated with Claude Code
Summary by CodeRabbit