Skip to content

CNTRLPLANE-3871: e2e: Remove osImageStream cleanup that violates immutability - #9206

Open
csrwng wants to merge 1 commit into
openshift:mainfrom
csrwng:fix-osimagestream-e2e-cleanup
Open

CNTRLPLANE-3871: e2e: Remove osImageStream cleanup that violates immutability#9206
csrwng wants to merge 1 commit into
openshift:mainfrom
csrwng:fix-osimagestream-e2e-cleanup

Conversation

@csrwng

@csrwng csrwng commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Remove the DeferCleanup block in NodePoolOSImageStreamExplicitDefaultNoRolloutTest that attempted to unset osImageStream after setting it to the version-derived default
  • A CEL validation rule prevents removing osImageStream once set, causing cleanup to fail with a 422 error
  • No restoration is needed since the test sets the field to the same value the controller derives implicitly

Jira

https://issues.redhat.com/browse/CNTRLPLANE-3871

Test plan

  • e2e-v2-aws-techpreview-osimagestream job passes without the 422 cleanup error

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Updated end-to-end coverage for default OS image stream behavior.
    • Simplified cleanup handling while preserving validation of version-derived defaults.

@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 commented Aug 3, 2026

Copy link
Copy Markdown

@csrwng: This pull request references CNTRLPLANE-3871 which is a valid jira issue.

Details

In response to this:

Summary

  • Remove the DeferCleanup block in NodePoolOSImageStreamExplicitDefaultNoRolloutTest that attempted to unset osImageStream after setting it to the version-derived default
  • A CEL validation rule prevents removing osImageStream once set, causing cleanup to fail with a 422 error
  • No restoration is needed since the test sets the field to the same value the controller derives implicitly

Jira

https://issues.redhat.com/browse/CNTRLPLANE-3871

Test plan

  • e2e-v2-aws-techpreview-osimagestream job passes without the 422 cleanup error

🤖 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.

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

coderabbitai Bot commented Aug 3, 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: e2e78162-1524-4b5f-a964-b31754913535

📥 Commits

Reviewing files that changed from the base of the PR and between d19dbf2 and 52a147e.

📒 Files selected for processing (1)
  • test/e2e/v2/tests/nodepool_osimagestream_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/e2e/v2/tests/nodepool_osimagestream_test.go

📝 Walkthrough

Walkthrough

The explicit-default OS image stream test no longer fetches the NodePool or resets spec.osImageStream during cleanup. The test retains the version-derived default because the field is immutable after assignment.

Suggested reviewers: jparrill, muraee

🚥 Pre-merge checks | ✅ 10 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning The test patches the shared default NodePool and leaves spec.osImageStream set; the sibling default-status test then skips when this field is set, violating test isolation and cleanup requirements. Run the explicit-default behavior against an isolated disposable NodePool and register DeferCleanup to delete it, or provide a supported restoration strategy.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the e2e cleanup removal and the immutability issue it addresses.
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 The PR changes only cleanup code. All Ginkgo Describe and It titles in the target file are static string literals with no run-dependent values.
Topology-Aware Scheduling Compatibility ✅ Passed The only changed file is an e2e Go test; the patch removes cleanup logic and adds no deployment, operator, controller, replica, affinity, topology, selector, toleration, or PDB scheduling constraints.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR only removes cleanup from an existing Ginkgo test; it adds no test and the affected code uses cluster management APIs without IPv4 assumptions or external connectivity.
No-Weak-Crypto ✅ Passed The PR only removes a NodePool cleanup patch and adds comments; the diff introduces no MD5, SHA1, DES, RC4, Blowfish, ECB, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed The patch changes only one Go e2e test and adds no container or Kubernetes manifest privilege settings; the patch contains none of the flagged indicators.
No-Sensitive-Data-In-Logs ✅ Passed The diff adds no logging statements. Existing logs contain NodePool names, a config hash, and RHEL stream identifiers, with no passwords, tokens, API keys, PII, hostnames, or customer data.
✨ 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 jparrill and muraee August 3, 2026 15:39
@openshift-ci

openshift-ci Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: csrwng

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. area/testing Indicates the PR includes changes for e2e testing and removed do-not-merge/needs-area labels Aug 3, 2026
The NodePoolOSImageStreamExplicitDefaultNoRolloutTest cleanup tried to
unset osImageStream after setting it to the version-derived default. A
CEL validation rule prevents removing osImageStream once set, causing
the cleanup to fail with a 422 error. Since the test sets the field to
the same value the controller derives implicitly, no restoration is
needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@csrwng
csrwng force-pushed the fix-osimagestream-e2e-cleanup branch from d19dbf2 to 52a147e Compare August 3, 2026 15:40
@csrwng

csrwng commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

When openshift/release#82438 merges, verify this change with:

/test e2e-v2-aws-techpreview-osimagestream

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.94%. Comparing base (923aba2) to head (52a147e).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9206   +/-   ##
=======================================
  Coverage   44.94%   44.94%           
=======================================
  Files         778      778           
  Lines       97427    97427           
=======================================
  Hits        43790    43790           
  Misses      50616    50616           
  Partials     3021     3021           
Flag Coverage Δ
cmd-support 38.62% <ø> (ø)
cpo-hostedcontrolplane 47.28% <ø> (ø)
cpo-other 45.67% <ø> (ø)
hypershift-operator 54.93% <ø> (ø)
other 34.32% <ø> (ø)

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.

@csrwng

csrwng commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

/test e2e-v2-aws-techpreview-osimagestream

@csrwng

csrwng commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

/verified by e2e

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Aug 4, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@csrwng: This PR has been marked as verified by e2e.

Details

In response to this:

/verified by e2e

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.

@muraee

muraee commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 4, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks-4-22
/test e2e-aws-4-22
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws
/test e2e-v2-azure-self-managed
/test e2e-v2-gke

@cwbotbot

cwbotbot commented Aug 4, 2026

Copy link
Copy Markdown

Test Results

e2e-aws

e2e-aks

@jparrill

jparrill commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

/lgtm

Good catch on the DeferCleanup — the CEL immutability rule at nodepool_types.go:104 made that cleanup impossible (422 on every run).

A few additional gaps I found while auditing the same file for our PR #9099 (already have fixes there):

Nit (this PR):

  • nodepool_osimagestream_test.go:368-369: Stale docstring still says "and restores it on cleanup" — should update since cleanup is removed.

Pre-existing gaps (not blocking, tracked in #9099):

  1. nodepool_osimagestream_test.go:287-301: expectedStream is declared as OSImageStreamRHEL10 but never used in the actual assertion — osImageStreamSetPredicate() accepts any recognized stream (rhel-9 or rhel-10) instead of validating the exact expected value. Should use a predicate that matches expectedStream exactly, and make it version-aware (rhel-10 on 5.0+, rhel-9 on < 5.0).

  2. nodepool_osimagestream_test.go:62: Comment says "skips when ... platform does not use RHCOS nodes" but the code only checks CRD schema fields — no platform check exists.

  3. nodepool_osimagestream_test.go:532: expectedStream hardcoded to rhel-9 in upgrade test, assumes E2E_PREVIOUS_RELEASE_IMAGE is always 4.x. Will break when 5.x→5.y upgrade tests are introduced.

I have fixes for all of these in #9099 — will rebase on top of yours once this merges.

@jparrill

jparrill commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

/retest-required

@jparrill

jparrill commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

/test ?

@jparrill

jparrill commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

/test e2e-v2-aws-techpreview-osimagestream

@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@csrwng: 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-v2-azure-self-managed 52a147e link true /test e2e-v2-azure-self-managed
ci/prow/e2e-aws-upgrade-hypershift-operator 52a147e link true /test e2e-aws-upgrade-hypershift-operator
ci/prow/e2e-kubevirt-aws-ovn-reduced 52a147e link true /test e2e-kubevirt-aws-ovn-reduced
ci/prow/e2e-aks-4-22 52a147e link true /test e2e-aks-4-22
ci/prow/e2e-aws 52a147e link true /test e2e-aws

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

approved Indicates a PR has been approved by an approver from all required OWNERS files. 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. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants