Skip to content

Pause worker MCP for image mirror tests#31425

Draft
JoelSpeed wants to merge 1 commit into
openshift:mainfrom
JoelSpeed:test-pausing-worker-pool
Draft

Pause worker MCP for image mirror tests#31425
JoelSpeed wants to merge 1 commit into
openshift:mainfrom
JoelSpeed:test-pausing-worker-pool

Conversation

@JoelSpeed

@JoelSpeed JoelSpeed commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

These tests create IMDS which affects all MCPs. The worker pool rolling out is hindering the progress on this test when a cluster is created with just two workers.

Summary by CodeRabbit

  • Tests
    • Improved node image mirror test isolation by pausing the worker pool during each test.
    • Automatically restores the worker pool to its active state during test cleanup.
    • Added safeguards to avoid disrupting test execution when worker pool state changes encounter setup or update issues.

@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: automatic 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 Jul 24, 2026
@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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

@JoelSpeed

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-disruptive-longrunning-techpreview

@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@JoelSpeed: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-disruptive-longrunning-techpreview

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/affe8a20-874a-11f1-8216-6da3073dc66c-0

@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: JoelSpeed
Once this PR has been reviewed and has the lgtm label, please assign haircommander for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Walkthrough

Image mirror set tests now pause the worker MachineConfigPool before each test and restore it afterward. Shared node utilities retrieve and update the pool only when its pause state differs from the requested state, logging setup or update failures.

Changes

Worker pool isolation

Layer / File(s) Summary
Worker pool pause helpers
test/extended/node/node_utils.go
Adds exported pause and unpause helpers that update the worker MachineConfigPool only when necessary and log client or update failures.
Image mirror test lifecycle integration
test/extended/node/node_e2e/image_mirror_set.go
Pauses the worker pool in BeforeEach and unpauses it in AfterEach.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • openshift/origin#31408: Refactors the mirror-set tests to wait for and validate the worker MachineConfigPool.

Suggested reviewers: ngopalak-redhat, bhargavigudi

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning Cleanup is unreliable: AfterEach always unpauses the worker MCP instead of restoring its original state, and worker-pool API failures are only logged. Capture and restore the original Spec.Paused value, and make EnsureWorkerPoolPaused/Unpaused return errors so setup/cleanup fails on client/get/update issues.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: pausing the worker MachineConfigPool for image mirror tests.
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 The changed Ginkgo titles are static literals; no pod/node/namespace/UUID/timestamp interpolation or generated suffixes appear.
Microshift Test Compatibility ✅ Passed The suite uses unsupported OpenShift APIs, but BeforeEach calls SkipOnMicroShift, which checks IsMicroShiftCluster() and skips the test on MicroShift.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The mirror-set test still targets one ready worker node and adds no multi-node, drain, anti-affinity, or rescheduling assumptions; no SNO-unsafe test was introduced.
Topology-Aware Scheduling Compatibility ✅ Passed Not applicable: this PR only adds e2e test helpers to pause/unpause the worker MCP; it doesn’t add pod scheduling constraints or controller topology logic.
Ote Binary Stdout Contract ✅ Passed The PR only adds helper calls and suite hooks; no main/init/TestMain/BeforeSuite/AfterSuite/RunSpecs stdout writes or fmt.Print/klog-to-stdout usages were introduced.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The new/changed Ginkgo tests only create mirror-set API objects and inspect registries.conf; no IPv4-only code or external network calls were added.
No-Weak-Crypto ✅ Passed The PR only pauses/unpauses the worker MCP in test setup/teardown and adds no crypto code, secret comparisons, or weak cipher/mode usage.
Container-Privileges ✅ Passed PASS: The PR only changes Go test/helpers; no container/K8s manifests or privileged fields (privileged, hostPID/network/IPC, SYS_ADMIN, allowPrivilegeEscalation) were added.
No-Sensitive-Data-In-Logs ✅ Passed Changed logs are generic MCP/client warnings and status messages; no passwords, tokens, PII, or customer data are logged.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

🤖 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/node/node_e2e/image_mirror_set.go`:
- Around line 214-218: Update the worker-pool setup around
EnsureWorkerPoolPaused and the g.AfterEach cleanup to capture the original pause
state, register cleanup with g.DeferCleanup after pausing succeeds, and restore
that exact state instead of always unpausing; preserve the existing setup
behavior for both initially paused and unpaused suites.

In `@test/extended/node/node_utils.go`:
- Around line 997-1023: Update ensureWorkerPoolPaused and its
EnsureWorkerPoolPaused/EnsureWorkerPoolUnpaused callers to return and propagate
errors from NewForConfig, MachineConfigPools().Get, and Update instead of only
logging them. Make the callers fail when the worker-pool operation fails, while
preserving the existing already-paused early return.
🪄 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 YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 35a80689-3a0c-43c0-b08e-430de7993e3c

📥 Commits

Reviewing files that changed from the base of the PR and between 398edca and 2d0b2c9.

📒 Files selected for processing (2)
  • test/extended/node/node_e2e/image_mirror_set.go
  • test/extended/node/node_utils.go

Comment on lines +214 to +218
nodeutils.EnsureWorkerPoolPaused(ctx, oc)
})

g.AfterEach(func(ctx context.Context) {
nodeutils.EnsureWorkerPoolUnpaused(ctx, oc)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the test file around the cited lines.
sed -n '180,250p' test/extended/node/node_e2e/image_mirror_set.go

# Find the pause/unpause helpers to understand whether they preserve original state.
rg -n "EnsureWorkerPool(Paused|Unpaused)|Paused" test/extended -g '*.go'

Repository: openshift/origin

Length of output: 4340


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Read the worker-pool helper implementation.
sed -n '990,1035p' test/extended/node/node_utils.go

Repository: openshift/origin

Length of output: 1498


Restore the worker pool’s original pause state.
AfterEach always unpauses the worker pool, so a suite that starts with Spec.Paused=true will leave the cluster in a different state. Capture the original value and restore that exact state, ideally with g.DeferCleanup after the pause succeeds.

🤖 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/node/node_e2e/image_mirror_set.go` around lines 214 - 218,
Update the worker-pool setup around EnsureWorkerPoolPaused and the g.AfterEach
cleanup to capture the original pause state, register cleanup with
g.DeferCleanup after pausing succeeds, and restore that exact state instead of
always unpausing; preserve the existing setup behavior for both initially paused
and unpaused suites.

Comment on lines +997 to +1023
func EnsureWorkerPoolPaused(ctx context.Context, oc *exutil.CLI) {
ensureWorkerPoolPaused(ctx, oc, true)
}

func EnsureWorkerPoolUnpaused(ctx context.Context, oc *exutil.CLI) {
ensureWorkerPoolPaused(ctx, oc, false)
}

func ensureWorkerPoolPaused(ctx context.Context, oc *exutil.CLI, paused bool) {
mcClient, err := machineconfigclient.NewForConfig(oc.AdminConfig())
if err != nil {
framework.Logf("Warning: failed to create MC client: %v", err)
}
workerPool, err := mcClient.MachineconfigurationV1().MachineConfigPools().Get(ctx, "worker", metav1.GetOptions{})
if err != nil {
framework.Logf("Warning: failed to get worker pool: %v", err)
}
if workerPool.Spec.Paused == paused {
framework.Logf("Worker pool is already paused=%v", paused)
return
}

workerPool.Spec.Paused = paused
_, err = mcClient.MachineconfigurationV1().MachineConfigPools().Update(ctx, workerPool, metav1.UpdateOptions{})
if err != nil {
framework.Logf("Warning: failed to update worker pool: %v", err)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the target region with line numbers
sed -n '960,1045p' test/extended/node/node_utils.go | cat -n

echo
echo '--- usages ---'
rg -n "EnsureWorkerPoolPaused|EnsureWorkerPoolUnpaused|ensureWorkerPoolPaused" -S .

Repository: openshift/origin

Length of output: 3702


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '960,1045p' test/extended/node/node_utils.go | cat -n

printf '\n--- usages ---\n'
rg -n "EnsureWorkerPoolPaused|EnsureWorkerPoolUnpaused|ensureWorkerPoolPaused" -S .

Repository: openshift/origin

Length of output: 3702


🏁 Script executed:

#!/bin/bash
set -euo pipefail
pwd

Repository: openshift/origin

Length of output: 173


Propagate worker-pool API errors

ensureWorkerPoolPaused logs NewForConfig, Get, and Update failures but still returns as if the pool was updated, so setup/cleanup can continue with the worker pool in the wrong state. Return an error and fail the caller instead.

🤖 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/node/node_utils.go` around lines 997 - 1023, Update
ensureWorkerPoolPaused and its EnsureWorkerPoolPaused/EnsureWorkerPoolUnpaused
callers to return and propagate errors from NewForConfig,
MachineConfigPools().Get, and Update instead of only logging them. Make the
callers fail when the worker-pool operation fails, while preserving the existing
already-paused early return.

Source: Path instructions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant