Skip to content

Add new image-mode mcp status reporting TC - #6346

Open
ptalgulk01 wants to merge 1 commit into
openshift:mainfrom
ptalgulk01:automate-mosb-status-conditions-on-mcp
Open

Add new image-mode mcp status reporting TC#6346
ptalgulk01 wants to merge 1 commit into
openshift:mainfrom
ptalgulk01:automate-mosb-status-conditions-on-mcp

Conversation

@ptalgulk01

@ptalgulk01 ptalgulk01 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor
  • Add tests OCP-89820, OCP-89821, OCP-89822 verifying MachineOSBuild lifecycle states (failed, succeeded, interrupted) are surfaced on MCP
    Updating condition
    • Each test covers both paused and unpaused MCP scenarios (MCO-2380/MCO-2381)
    • Add 4 reusable validation helpers with auto-detect of MCP pause state: ValidateFailedMOSBConditionOnMCP,
      ValidateInterruptedMOSBConditionOnMCP, ValidateMOSBBuildingConditionOnMCP, ValidateSucceededMOSBConditionOnMCP

Summary by CodeRabbit

  • Tests
    • Added coverage for MachineConfigPool update conditions during MachineOSBuild failure, interruption, building, and successful completion.
    • Verified condition status and messages for both active and paused machine configuration pools.
    • Added scenarios covering invalid and valid MachineOSConfig content.

@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

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Walkthrough

Changes

MCP Updating condition coverage

Layer / File(s) Summary
MCP condition validation helpers
test/extended-priv/mco_ocb.go
Added helpers validating MCP Updating status and message values for failed, interrupted, building, and succeeded MachineOSBuild conditions, including paused-pool variants.
Disruptive MachineOSBuild scenarios
test/extended-priv/mco_ocb.go
Added disruptive tests covering failed, interrupted, building, and successful builds while MCP pools are running or paused.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested labels: jira/valid-reference

Suggested reviewers: harshwardhanpatil07, isabella-janssen

🚥 Pre-merge checks | ✅ 13 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning The new MOSC tests create cluster-scoped MachineOSConfig resources without deferred cleanup, so any earlier failure leaks resources; MachineOSConfig uses NewResource (no namespace). Add defer CleanupAndDelete/DisableOCL immediately after each MOSC creation, then keep the explicit cleanup later if you still need to wait for teardown.
Microshift Test Compatibility ⚠️ Warning New It cases 89820-89822 use machineconfiguration.openshift.io MCP/MOSC/MOSB APIs and lack any MicroShift skip or apigroup tag. Mark them [Skipped:MicroShift] or add [apigroup:machineconfiguration.openshift.io] (or a runtime exutil.IsMicroShiftCluster() g.Skip) so MicroShift jobs skip them.
✅ Passed checks (13 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: new image-mode MCP status reporting test cases and helpers.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 All Ginkgo titles in mco_ocb.go are static strings; no dynamic values or run-to-run identifiers appear in test names.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The new tests only verify MCP/MOSC/MOSB and build-job status; they create an empty custom pool and do not count, drain, or schedule across multiple nodes.
Topology-Aware Scheduling Compatibility ✅ Passed PASS: The PR only adds disruptive tests/helpers in test/extended-priv/mco_ocb.go; no deployment manifests, operator code, or scheduling constraints were added.
Ote Binary Stdout Contract ✅ Passed No new stdout writes or suite/process-level hooks were added; the new helpers/tests only use Ginkgo/Gomega and logger.Infof, which routes to GinkgoWriter.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The new Ginkgo cases use only cluster-internal MCP/MOSC flows and no IPv4-only parsing, hardcoded IPs, or direct public-internet calls.
No-Weak-Crypto ✅ Passed The added test/helpers in mco_ocb.go only assert MCP/MOSB status messages; no weak crypto, custom crypto, or secret/token comparisons appear.
Container-Privileges ✅ Passed Only modified file is a Go test helper; no privileged, host*, SYS_ADMIN, allowPrivilegeEscalation, or root container/K8s manifest settings were added.
No-Sensitive-Data-In-Logs ✅ Passed New code only adds generic status logs (mostly OK!) and test names; no passwords, tokens, PII, hostnames, or customer data are logged in the added lines.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci
openshift-ci Bot requested review from pablintino and umohnani8 July 28, 2026 11:06
@openshift-ci

openshift-ci Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ptalgulk01

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 Jul 28, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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/extended-priv/mco_ocb.go`:
- Around line 1124-1152: Update the expected MCP Updating message substrings in
ValidateMOSBBuildingConditionOnMCP to match the controller’s Building-state
wording: use “Pool is paused; OS image build in progress (mosb: %s)” for paused
pools and “Pool is waiting for OS image build to complete (mosb: %s)” for
non-paused pools. Remove the Prepared-state “to start” and extra-“is” variants
while preserving the existing Eventually assertions and formatting.
🪄 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: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 588bb876-6dec-4f15-8956-96fe600c2876

📥 Commits

Reviewing files that changed from the base of the PR and between 777892a and fbe1b16.

📒 Files selected for processing (1)
  • test/extended-priv/mco_ocb.go

Comment on lines +1124 to +1152
func ValidateMOSBBuildingConditionOnMCP(mosc *MachineOSConfig, mosb *MachineOSBuild, mcp *MachineConfigPool) {
exutil.By("Validate that MOSB building state is surfaced on MCP Updating condition")

o.Eventually(mosb, "5m", "20s").Should(HaveConditionField("Building", "status", TrueString),
"MachineOSBuild didn't report that the build has begun")

if mcp.IsPaused() {
o.Eventually(mcp, "5m", "20s").Should(HaveConditionField("Updating", "status", TrueString),
"MCP Updating status should be True when build is in progress (paused)")
o.Eventually(mcp, "2m", "20s").Should(HaveConditionField("Updating", "message",
o.Or(
o.ContainSubstring(fmt.Sprintf("Pool is paused; waiting for a new OS image build to start (mosc: %s)", mosc.GetName())),
o.ContainSubstring(fmt.Sprintf("Pool is paused; waiting for OS image build to start (mosb: %s)", mosb.GetName())),
o.ContainSubstring(fmt.Sprintf("Pool is paused; OS image build is in progress (mosb: %s)", mosb.GetName())),
)),
"MCP Updating message was not the expected one during building (paused)")
} else {
o.Eventually(mcp, "5m", "20s").Should(HaveConditionField("Updating", "status", TrueString),
"MCP Updating status should be True when build is in progress")
o.Eventually(mcp, "2m", "20s").Should(HaveConditionField("Updating", "message",
o.Or(
o.ContainSubstring(fmt.Sprintf("Pool is waiting for a new OS image build to start (mosc: %s)", mosc.GetName())),
o.ContainSubstring(fmt.Sprintf("Pool is waiting for OS image build to start (mosb: %s)", mosb.GetName())),
o.ContainSubstring(fmt.Sprintf("OS image build is in progress (mosb: %s)", mosb.GetName())),
)),
"MCP Updating message was not the expected one during building")
}
logger.Infof("OK!\n")
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Expected Updating message substrings don't match the controller's actual "Building" messages — this assertion will always fail.

Per the upstream contract in pkg/controller/node/status.go, once mosb is in the Building state:

  • Non-paused message is "Pool is waiting for OS image build to complete (mosb: %s)".
  • Paused message is "Pool is paused; OS image build in progress (mosb: %s)".

Neither of these appears in the Or() substring lists here. The non-paused list checks for "...to start (mosb: %s)" and "OS image build is in progress (mosb: %s)" (extra "is", never emitted by the controller), and the paused list checks "...waiting for OS image build to start..." (that's the Prepared-state wording, not Building) plus the same extra-"is" variant. ContainSubstring only succeeds if the actual string literally contains the given substring, so once mosb reaches Building and the MCP reconciles, this Eventually will time out and fail deterministically — breaking the new [PolarionID:89821] disruptive test (call sites at Lines 400 and 429).

🐛 Proposed fix aligning expected substrings with controller-generated messages
 	if mcp.IsPaused() {
 		o.Eventually(mcp, "5m", "20s").Should(HaveConditionField("Updating", "status", TrueString),
 			"MCP Updating status should be True when build is in progress (paused)")
 		o.Eventually(mcp, "2m", "20s").Should(HaveConditionField("Updating", "message",
 			o.Or(
 				o.ContainSubstring(fmt.Sprintf("Pool is paused; waiting for a new OS image build to start (mosc: %s)", mosc.GetName())),
-				o.ContainSubstring(fmt.Sprintf("Pool is paused; waiting for OS image build to start (mosb: %s)", mosb.GetName())),
-				o.ContainSubstring(fmt.Sprintf("Pool is paused; OS image build is in progress (mosb: %s)", mosb.GetName())),
+				o.ContainSubstring(fmt.Sprintf("Pool is paused; OS image build has been prepared but will not rollout (mosb: %s)", mosb.GetName())),
+				o.ContainSubstring(fmt.Sprintf("Pool is paused; OS image build in progress (mosb: %s)", mosb.GetName())),
 			)),
 			"MCP Updating message was not the expected one during building (paused)")
 	} else {
 		o.Eventually(mcp, "5m", "20s").Should(HaveConditionField("Updating", "status", TrueString),
 			"MCP Updating status should be True when build is in progress")
 		o.Eventually(mcp, "2m", "20s").Should(HaveConditionField("Updating", "message",
 			o.Or(
 				o.ContainSubstring(fmt.Sprintf("Pool is waiting for a new OS image build to start (mosc: %s)", mosc.GetName())),
 				o.ContainSubstring(fmt.Sprintf("Pool is waiting for OS image build to start (mosb: %s)", mosb.GetName())),
-				o.ContainSubstring(fmt.Sprintf("OS image build is in progress (mosb: %s)", mosb.GetName())),
+				o.ContainSubstring(fmt.Sprintf("Pool is waiting for OS image build to complete (mosb: %s)", mosb.GetName())),
 			)),
 			"MCP Updating message was not the expected one during building")
 	}

Please double-check the exact current wording in the controller since it's authoritative:

#!/bin/bash
rg -n "Pool is (paused; )?(OS image build|waiting)" pkg/controller/node/status.go
🤖 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/extended-priv/mco_ocb.go` around lines 1124 - 1152, Update the expected
MCP Updating message substrings in ValidateMOSBBuildingConditionOnMCP to match
the controller’s Building-state wording: use “Pool is paused; OS image build in
progress (mosb: %s)” for paused pools and “Pool is waiting for OS image build to
complete (mosb: %s)” for non-paused pools. Remove the Prepared-state “to start”
and extra-“is” variants while preserving the existing Eventually assertions and
formatting.

@openshift-ci

openshift-ci Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@ptalgulk01: 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/bootstrap-unit fbe1b16 link true /test bootstrap-unit

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.

@isabella-janssen

Copy link
Copy Markdown
Member

/hold

Holding to allow the Kube rebase to land in #6321

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 28, 2026
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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants