Skip to content

MCO-2155: Add stream detection to boot image tests#5784

Open
djoshy wants to merge 1 commit intoopenshift:mainfrom
djoshy:exclude-rhel10-from-bootimage-tests
Open

MCO-2155: Add stream detection to boot image tests#5784
djoshy wants to merge 1 commit intoopenshift:mainfrom
djoshy:exclude-rhel10-from-bootimage-tests

Conversation

@djoshy
Copy link
Contributor

@djoshy djoshy commented Mar 20, 2026

- What I did
Follow-up to #5752. This PR skips all bootimage tests in the disruptive suite if a machineset with non defauilt stream label is found.

- How to verify it
All bootimage e2es should continue to pass. This only changes test code, so additional QE is not required.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 20, 2026
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Mar 20, 2026

@djoshy: This pull request references MCO-2155 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

- What I did
Follow-up to #5752. This PR skips all bootimage tests in the disruptive suite if a machineset with non defauilt stream label is found.

- How to verify it
All bootimage e2es should continue to pass. This only changes test code, so additional QE is not required.

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.

@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

Walkthrough

The PR introduces OS stream label validation for boot image tests by extracting a constant reference to a dedicated package and adding test skip conditions that prevent suite execution when MachineSets or ControlPlaneMachineSet have unsupported OS stream labels.

Changes

Cohort / File(s) Summary
Core constant extraction
pkg/controller/bootimage/boot_image_controller.go
Updated SupportedOSStream constant from hardcoded string "rhel-9" to osimagestream.StreamNameRHEL9 and added corresponding import.
Test utilities
test/extended-priv/util/clusters.go
Added OS stream label key constant ("machineconfiguration.openshift.io/osstream"), supported OS stream constant ("rhel-9"), and two skip-helper functions: SkipIfUnsupportedOSStreamLabel (checks MachineSets) and SkipIfCPMSHasUnsupportedOSStreamLabel (checks ControlPlaneMachineSet).
Test suite skip conditions
test/extended-priv/mco_bootimages.go, test/extended-priv/mco_controlplanemachineset.go, test/extended/boot_image_update_azure.go
Added pre-test skip conditions in JustBeforeEach or BeforeEach hooks to skip test suite execution when MachineSets or ControlPlaneMachineSet contain unsupported OS stream labels.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 20, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: djoshy

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 Mar 20, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
test/extended-priv/util/clusters.go (1)

73-86: Consider distinguishing NotFound from other errors.

Currently, any error from Get() (including transient network issues or permission errors) is silently ignored. While this is acceptable for test robustness, you may want to explicitly check for NotFound to avoid masking unexpected failures.

♻️ Optional: Explicit NotFound check
+	apierrors "k8s.io/apimachinery/pkg/api/errors"
 	cpms, err := mc.MachineV1().ControlPlaneMachineSets("openshift-machine-api").Get(context.TODO(), "cluster", metav1.GetOptions{})
 	if err != nil {
-		// CPMS not present — no label to check
-		return
+		if apierrors.IsNotFound(err) {
+			// CPMS not present — no label to check
+			return
+		}
+		o.Expect(err).NotTo(o.HaveOccurred(), "failed to get ControlPlaneMachineSet")
 	}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/extended-priv/util/clusters.go` around lines 73 - 86, In
SkipIfCPMSHasUnsupportedOSStreamLabel, don't ignore all errors from
mc.MachineV1().ControlPlaneMachineSets(...).Get; import the k8s API errors
package and explicitly check apierrors.IsNotFound(err) and return for NotFound,
but for any other error call o.Expect(err).NotTo(o.HaveOccurred(), ...) (or
otherwise fail/propagate) so transient/permission/network errors aren't silently
masked; keep the current label check logic for the successful Get.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@test/extended-priv/util/clusters.go`:
- Around line 73-86: In SkipIfCPMSHasUnsupportedOSStreamLabel, don't ignore all
errors from mc.MachineV1().ControlPlaneMachineSets(...).Get; import the k8s API
errors package and explicitly check apierrors.IsNotFound(err) and return for
NotFound, but for any other error call o.Expect(err).NotTo(o.HaveOccurred(),
...) (or otherwise fail/propagate) so transient/permission/network errors aren't
silently masked; keep the current label check logic for the successful Get.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 06fb827d-db70-4f3d-aa6f-adf93d38c9a7

📥 Commits

Reviewing files that changed from the base of the PR and between 15c41cf and dd1bfb0.

📒 Files selected for processing (5)
  • pkg/controller/bootimage/boot_image_controller.go
  • test/extended-priv/mco_bootimages.go
  • test/extended-priv/mco_controlplanemachineset.go
  • test/extended-priv/util/clusters.go
  • test/extended/boot_image_update_azure.go

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 20, 2026

@djoshy: 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-hypershift dd1bfb0 link true /test e2e-hypershift

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

2 participants