Skip to content

OCPBUGS-85344: Add version gates for 4.22 backward compatibility in e2e tests#8466

Open
csrwng wants to merge 1 commit intoopenshift:mainfrom
csrwng:fix-422-e2e
Open

OCPBUGS-85344: Add version gates for 4.22 backward compatibility in e2e tests#8466
csrwng wants to merge 1 commit intoopenshift:mainfrom
csrwng:fix-422-e2e

Conversation

@csrwng
Copy link
Copy Markdown
Contributor

@csrwng csrwng commented May 8, 2026

What this PR does / why we need it:

The e2e test binary from main fails when run against 4.22 hosted clusters. This was discovered when openshift/release#78912 changed the 4.22 CI config to use the pre-built e2e binary from main instead of building from the 4.22 branch.

Changes:

  • CAPI condition bubbling (nodepool_test.go): Gate validateCAPIConditionBubblingDuringProvisioning and the AllMachinesReady/AllNodesHealthy Reason/Message checks behind IsGreaterThanOrEqualTo(Version423), since the CAPI v1 condition aggregation logic only exists in 4.23+.
  • Karpenter tests (karpenter_test.go): Add ShouldRunKarpenterTests helper that gates on 4.23 by default (the karpenter.hypershift.openshift.io/v1 API only exists on main), but lowers the gate to 4.22 when RUN_KARPENTER_TESTS=true is set — for CI jobs like e2e-aws-4-22 where the operator is built from main but tested against 4.22 clusters.

Which issue(s) this PR fixes:

Fixes https://issues.redhat.com/browse/OCPBUGS-85344

Special notes for your reviewer:

Depends on openshift/release#78912 for the CI config change that switches the 4.22 branch to use the e2e binary from main.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • Tests
    • Updated test execution gating mechanism for Karpenter e2e tests with environment variable-based control.
    • Refined version-specific test conditions for NodePool validations to ensure proper compatibility checks.
    • Improved test preconditions to enforce minimum version requirements based on feature availability.

The CAPI condition bubbling validation and Reason/Message checks for
AllMachinesReady/AllNodesHealthy were introduced in 4.23. Gate these
behind IsGreaterThanOrEqualTo(Version423) so the e2e binary from main
can run against 4.22 clusters without false failures.

Add ShouldRunKarpenterTests helper to gate Karpenter tests behind 4.23
since the karpenter.hypershift.openshift.io/v1 API only exists on main.
When RUN_KARPENTER_TESTS=true is set (e.g. in e2e-aws-4-22 CI jobs
where the operator is from main), the gate is lowered to 4.22.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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 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 May 8, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 8, 2026

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-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 8, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@csrwng: This pull request references Jira Issue OCPBUGS-85344, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

What this PR does / why we need it:

The e2e test binary from main fails when run against 4.22 hosted clusters. This was discovered when openshift/release#78912 changed the 4.22 CI config to use the pre-built e2e binary from main instead of building from the 4.22 branch.

Changes:

  • CAPI condition bubbling (nodepool_test.go): Gate validateCAPIConditionBubblingDuringProvisioning and the AllMachinesReady/AllNodesHealthy Reason/Message checks behind IsGreaterThanOrEqualTo(Version423), since the CAPI v1 condition aggregation logic only exists in 4.23+.
  • Karpenter tests (karpenter_test.go): Add ShouldRunKarpenterTests helper that gates on 4.23 by default (the karpenter.hypershift.openshift.io/v1 API only exists on main), but lowers the gate to 4.22 when RUN_KARPENTER_TESTS=true is set — for CI jobs like e2e-aws-4-22 where the operator is built from main but tested against 4.22 clusters.

Which issue(s) this PR fixes:

Fixes https://issues.redhat.com/browse/OCPBUGS-85344

Special notes for your reviewer:

Depends on openshift/release#78912 for the CI config change that switches the 4.22 branch to use the e2e binary from main.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

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 openshift-ci Bot added do-not-merge/needs-area area/testing Indicates the PR includes changes for e2e testing and removed do-not-merge/needs-area labels May 8, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 8, 2026

[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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 8, 2026
@csrwng
Copy link
Copy Markdown
Contributor Author

csrwng commented May 8, 2026

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 8, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@csrwng: This pull request references Jira Issue OCPBUGS-85344, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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.

@csrwng csrwng marked this pull request as ready for review May 8, 2026 15:44
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 8, 2026
@openshift-ci openshift-ci Bot requested review from bryan-cox and clebs May 8, 2026 15:44
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

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: ff8179ee-3d01-4ac6-af1b-ea8caad1b3ff

📥 Commits

Reviewing files that changed from the base of the PR and between 2780a7b and 949ad3d.

📒 Files selected for processing (3)
  • test/e2e/karpenter_test.go
  • test/e2e/nodepool_test.go
  • test/e2e/util/version.go

📝 Walkthrough

Walkthrough

This pull request modifies Karpenter e2e test execution logic and version gating across three files. It introduces a new ShouldRunKarpenterTests() utility function that gates Karpenter e2e tests based on the RUN_KARPENTER_TESTS environment variable, requiring version 4.22.0 or later when enabled, and 4.23.0 otherwise. The Karpenter test now uses this new function instead of a static version check. Additionally, the NodePool test conditions were updated to apply CAPI condition validation and steady-state condition assertions only for version 4.23.0 and later.


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Stable And Deterministic Test Names ❌ Error Dynamic test name found at test/e2e/nodepool_test.go line 206: t.Run(fmt.Sprintf("HostedCluster%d", i)). Uses loop variable i in test title, violating requirement for static deterministic test names. Replace fmt.Sprintf with static name like "HostedClusterNodePoolTests" that doesn't depend on array indices or implementation details.
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 accurately describes the main change: adding version gates to maintain 4.22 backward compatibility in e2e tests, which aligns with the objective of gating CAPI condition checks and Karpenter tests behind version conditions.
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.
Test Structure And Quality ✅ Passed Changes add version gates for 4.22 compatibility. Tests maintain quality standards: single responsibility, proper timeouts (10/20 min), meaningful assertion messages, and consistent patterns.
Microshift Test Compatibility ✅ Passed TestKarpenter is gated by version check via ShouldRunKarpenterTests(). TestNodePool tests use HyperShift native APIs. Tests properly protected from incompatible environments.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests added. PR only modifies version gating in existing tests and adds a utility function.
Topology-Aware Scheduling Compatibility ✅ Passed The PR modifies only test files (test/e2e/*.go), not deployment manifests, operator code, or controllers. No scheduling constraints or topology-aware considerations apply to test files.
Ote Binary Stdout Contract ✅ Passed All changes are within test-level code. The new ShouldRunKarpenterTests() function only calls AtLeast() which uses t.Skipf(). No process-level stdout writes detected.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR does not add any new Ginkgo e2e tests (It(), Describe(), Context(), When()). It only modifies existing test preconditions and adds a utility function. The custom check is not applicable.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 37.53%. Comparing base (9638d44) to head (949ad3d).
⚠️ Report is 20 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8466   +/-   ##
=======================================
  Coverage   37.53%   37.53%           
=======================================
  Files         751      751           
  Lines       92003    92025   +22     
=======================================
+ Hits        34531    34543   +12     
- Misses      54831    54841   +10     
  Partials     2641     2641           

see 2 files with indirect coverage changes

Flag Coverage Δ
cmd-support 32.76% <ø> (ø)
cpo-hostedcontrolplane 36.77% <ø> (ø)
cpo-other 37.76% <ø> (+0.03%) ⬆️
hypershift-operator 47.93% <ø> (ø)
other 27.77% <ø> (ø)

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-robot
Copy link
Copy Markdown

@csrwng: This pull request references Jira Issue OCPBUGS-85344, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

What this PR does / why we need it:

The e2e test binary from main fails when run against 4.22 hosted clusters. This was discovered when openshift/release#78912 changed the 4.22 CI config to use the pre-built e2e binary from main instead of building from the 4.22 branch.

Changes:

  • CAPI condition bubbling (nodepool_test.go): Gate validateCAPIConditionBubblingDuringProvisioning and the AllMachinesReady/AllNodesHealthy Reason/Message checks behind IsGreaterThanOrEqualTo(Version423), since the CAPI v1 condition aggregation logic only exists in 4.23+.
  • Karpenter tests (karpenter_test.go): Add ShouldRunKarpenterTests helper that gates on 4.23 by default (the karpenter.hypershift.openshift.io/v1 API only exists on main), but lowers the gate to 4.22 when RUN_KARPENTER_TESTS=true is set — for CI jobs like e2e-aws-4-22 where the operator is built from main but tested against 4.22 clusters.

Which issue(s) this PR fixes:

Fixes https://issues.redhat.com/browse/OCPBUGS-85344

Special notes for your reviewer:

Depends on openshift/release#78912 for the CI config change that switches the 4.22 branch to use the e2e binary from main.

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • Tests
  • Updated test execution gating mechanism for Karpenter e2e tests with environment variable-based control.
  • Refined version-specific test conditions for NodePool validations to ensure proper compatibility checks.
  • Improved test preconditions to enforce minimum version requirements based on feature availability.

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.

@enxebre
Copy link
Copy Markdown
Member

enxebre commented May 8, 2026

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 8, 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-azure-self-managed
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws

enxebre added a commit to enxebre/release that referenced this pull request May 8, 2026
Set RUN_KARPENTER_TESTS=true in the e2e-aws test env for the
release-4.22 config. This allows the karpenter e2e tests to run
against 4.22 clusters when the operator is built from main.

Depends on: openshift/hypershift#8466

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
enxebre added a commit to enxebre/release that referenced this pull request May 8, 2026
Set RUN_KARPENTER_TESTS=true in the e2e-aws-4-22 test env in the
main config. This allows the karpenter e2e tests to run against
4.22 hosted clusters when the operator is built from main.

Depends on: openshift/hypershift#8466

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
enxebre added a commit to enxebre/release that referenced this pull request May 8, 2026
Set RUN_KARPENTER_TESTS=true in the e2e-aws-4-22 test env in the
main config. This allows the karpenter e2e tests to run against
4.22 hosted clusters when the operator is built from main.

Depends on: openshift/hypershift#8466

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cwbotbot
Copy link
Copy Markdown

cwbotbot commented May 8, 2026

Test Results

e2e-aws

e2e-aks

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 8, 2026

@csrwng: 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

/verified by e2e

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-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants