Skip to content

SPLAT-2858: Fixing test issue where error result was for other resource type#1522

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
vr4manta:SPLAT-2858
Jul 21, 2026
Merged

SPLAT-2858: Fixing test issue where error result was for other resource type#1522
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
vr4manta:SPLAT-2858

Conversation

@vr4manta

@vr4manta vr4manta commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

SPLAT-2858

Changes

  • Fixed flaky test that fails when failure domain is shared by another resource type
  • Cleaned up duplicate code

Summary by CodeRabbit

  • Tests
    • Improved vSphere failure-domain coverage to correctly account for domains referenced by Machines, MachineSets, and ControlPlaneMachineSets.
    • Updated failure-domain selection logic used in e2e validation to avoid removing/deleting ControlPlaneMachineSet-referenced domains.
    • Generalized admission-error assertions to reflect whether failures are blocked by Machines alone or by Machines plus ControlPlaneMachineSet.
    • Reduced duplicated failure-domain detection by consolidating shared test helper behavior.

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

openshift-ci-robot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: This pull request references SPLAT-2858 which is a valid jira issue.

Details

In response to this:

SPLAT-2858

Changes

  • Fixed flaky test that fails when failure domain is shared by another resource type
  • Cleaned up duplicate code

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 requested review from RadekManak and mdbooth July 20, 2026 11:36
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1bb4c275-812d-494c-9425-bf86f45ce8df

📥 Commits

Reviewing files that changed from the base of the PR and between 5ef0edb and 7dad2fb.

📒 Files selected for processing (1)
  • test/e2e/vsphere/failure_domain_vap.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/e2e/vsphere/failure_domain_vap.go

Walkthrough

The vSphere failure-domain tests now detect Machine, MachineSet, and ControlPlaneMachineSet references through shared helpers. Selection tracks CPMS exclusions and exclusivity, while removal scenarios account for unused, exclusive, and shared failure domains.

Changes

vSphere failure-domain reference tracking

Layer / File(s) Summary
Reference helpers and failure-domain selection
test/e2e/vsphere/failure_domain_vap.go
Adds shared Machine, MachineSet, and CPMS reference checks, and updates failure-domain selection to track CPMS exclusions and exclusivity.
Removal scenarios and assertions
test/e2e/vsphere/failure_domain_vap.go
Selects unused domains only when no workload or CPMS references exist, and adjusts admission error expectations for shared references.

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

Suggested reviewers: radekmanak

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 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: it fixes a flaky test that misattributes errors when a failure domain is shared by another resource type.
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 the changed file are static strings; no dynamic identifiers, timestamps, or generated names appear in test names.
Test Structure And Quality ✅ Passed Tests use BeforeEach and DeferCleanup, include a bounded Eventually, and the new assertions/messages match repo patterns.
Microshift Test Compatibility ✅ Passed All new It() cases are tagged [apigroup:machine.openshift.io], which MicroShift skips automatically; no unguarded unsupported APIs or namespaces are introduced.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PASS: The file only refactors FD-selection tests; no node-count, rescheduling, or HA assumptions were added, and cases skip when required resources are absent.
Topology-Aware Scheduling Compatibility ✅ Passed PASS: The PR only changes an e2e vSphere test helper; no manifests, controllers, or pod scheduling constraints were added.
Ote Binary Stdout Contract ✅ Passed The PR only changes a Ginkgo test file; it adds helpers and It/BeforeEach code, with no main/init/TestMain/BeforeSuite stdout writes.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No IPv4-only assumptions or external connectivity were added; the vSphere e2e tests only use cluster APIs and infra labels/resources.
No-Weak-Crypto ✅ Passed The only changed file is a Ginkgo test helper; it contains no weak-crypto algorithms, custom crypto, or secret/token comparisons.
Container-Privileges ✅ Passed Only test/e2e/vsphere/failure_domain_vap.go changed; diff contains no privileged, hostPID/hostNetwork/hostIPC, allowPrivilegeEscalation, SYS_ADMIN, or root security context.
No-Sensitive-Data-In-Logs ✅ Passed The changed test file only logs MachineSet/failure-domain names and cleanup errors; no passwords, tokens, PII, session IDs, or hostnames are logged.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/e2e/vsphere/failure_domain_vap.go (1)

378-399: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Make “exclusive” exclude every competing VAP resource type.

Both tests only exclude CPMS domains. A selected FD can still be referenced by the other resource type, whose VAP may produce the admission error first; the exclusive assertions then flake.

  • test/e2e/vsphere/failure_domain_vap.go#L378-L399: exclude MachineSet-referenced domains before asserting that only the Machine VAP can block removal, or accept the MachineSet error on fallback.
  • test/e2e/vsphere/failure_domain_vap.go#L409-L448: exclude Machine-referenced domains before asserting that only the MachineSet VAP can block removal, or accept the Machine error on fallback.
🤖 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/e2e/vsphere/failure_domain_vap.go` around lines 378 - 399, Make both VAP
tests account for every competing resource type when determining exclusivity: in
the Machine-focused block around findFDUsedByMachine, exclude failure domains
referenced by MachineSets before asserting the error names a Machine, or allow a
MachineSet error as fallback; in the MachineSet-focused block around lines
409-448, exclude Machine-referenced domains before asserting only the
ControlPlaneMachineSet VAP can block removal, or allow a Machine error as
fallback.
🤖 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/e2e/vsphere/failure_domain_vap.go`:
- Around line 99-112: Update findFDUsedByMachine so the single-failure-domain
branch does not return found=true merely because one failure domain exists.
Remove or bypass that inference and determine usage only from explicit Machine
region or zone label matches, preserving the exclusion handling for confirmed
matches.
- Around line 349-353: Update the unused-domain selection loop around
isFDReferencedByMachine and isFDReferencedByMachineSet to also exclude domains
referenced by CPMS objects. Fetch the CPMS name set before iterating, then skip
any fd whose name is present in that set so unusedFDName is selected only from
domains unreferenced by Machines, MachineSets, and CPMS.
- Around line 53-57: Update getCPMSFailureDomainNames to return both the
domain-name map and an error; treat only metav1/API IsNotFound errors as an
empty result, and propagate all other ControlPlaneMachineSets(...).Get failures.
Update every caller to handle the returned error and stop or propagate it
instead of classifying domains from a failed lookup.

---

Outside diff comments:
In `@test/e2e/vsphere/failure_domain_vap.go`:
- Around line 378-399: Make both VAP tests account for every competing resource
type when determining exclusivity: in the Machine-focused block around
findFDUsedByMachine, exclude failure domains referenced by MachineSets before
asserting the error names a Machine, or allow a MachineSet error as fallback; in
the MachineSet-focused block around lines 409-448, exclude Machine-referenced
domains before asserting only the ControlPlaneMachineSet VAP can block removal,
or allow a Machine error as fallback.
🪄 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: Enterprise

Run ID: 050c16c0-0e07-4318-b75f-ee3e0458c258

📥 Commits

Reviewing files that changed from the base of the PR and between 417ad2f and 3343ccf.

📒 Files selected for processing (1)
  • test/e2e/vsphere/failure_domain_vap.go

Comment thread test/e2e/vsphere/failure_domain_vap.go Outdated
Comment thread test/e2e/vsphere/failure_domain_vap.go Outdated
Comment thread test/e2e/vsphere/failure_domain_vap.go
@vr4manta

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-techpreview-serial

@openshift-ci

openshift-ci Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: 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-ovn-techpreview-serial

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/ac562a90-8434-11f1-9112-5cbf294325a5-0

@vr4manta

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-zones-techpreview-serial

@openshift-ci

openshift-ci Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: 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-ovn-zones-techpreview-serial

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/b95abd50-8439-11f1-845e-9e0ce034060e-0

@vr4manta

Copy link
Copy Markdown
Contributor Author

/retest

@vr4manta

Copy link
Copy Markdown
Contributor Author

Payload jobs both passed. Flaky test seems to be stable now.

ContainSubstring("in use by ControlPlaneMachineSet '"),
), "expected error to mention 'Machine' or 'ControlPlaneMachineSet' as the blocking resource")
}
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewer's note: this is the bugfux.

Comment thread test/e2e/vsphere/failure_domain_vap.go Outdated

if unusedFDName == "" {
Skip("skipping — all failure domains are in use by Machines or MachineSets")
Skip("skipping — all failure domains are in use by Machines, MachineSets, or ControlPlaneMachineSet")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

super nit: ControlPlaneMachineSets

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i'll fix that. thx!

@mdbooth mdbooth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/approve

@openshift-ci

openshift-ci Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mdbooth

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 21, 2026
@mfbonfigli

Copy link
Copy Markdown

Unit tests are failing but it doesnt seem to be related, maybe take a look. Other than that lgtm

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 21, 2026
@vr4manta

Copy link
Copy Markdown
Contributor Author

/retest

@vr4manta

Copy link
Copy Markdown
Contributor Author

/verified by @vr4manta via /payload-jobs

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jul 21, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@vr4manta: This PR has been marked as verified by @vr4manta via /payload-jobs.

Details

In response to this:

/verified by @vr4manta via /payload-jobs

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.

@vr4manta

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci

openshift-ci Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: 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.

@openshift-merge-bot
openshift-merge-bot Bot merged commit a19340b into openshift:main Jul 21, 2026
11 checks passed
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. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants