MCO-2155: Add stream detection to boot image tests#5784
MCO-2155: Add stream detection to boot image tests#5784djoshy wants to merge 1 commit intoopenshift:mainfrom
Conversation
|
@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. DetailsIn response to this:
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. |
WalkthroughThe 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
🧹 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 forNotFoundto 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
📒 Files selected for processing (5)
pkg/controller/bootimage/boot_image_controller.gotest/extended-priv/mco_bootimages.gotest/extended-priv/mco_controlplanemachineset.gotest/extended-priv/util/clusters.gotest/extended/boot_image_update_azure.go
|
@djoshy: 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. |
- 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.