SPLAT-2813: Create VAP E2Es#1517
Conversation
|
@vr4manta: This pull request references SPLAT-2813 which is a valid jira issue. 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. |
|
Skipping CI for Draft Pull Request. |
WalkthroughAdds a vSphere end-to-end test suite for failure-domain ValidatingAdmissionPolicies. The tests verify policy deployment and Infrastructure failure-domain removal behavior when domains are referenced by Machines, MachineSets, or ControlPlaneMachineSets. ChangesvSphere failure-domain VAP tests
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant VAPSuite
participant MachineAPI
participant AdmissionPolicy
participant Infrastructure
VAPSuite->>MachineAPI: create or inspect Machine API references
VAPSuite->>Infrastructure: submit failure-domain removal
Infrastructure->>AdmissionPolicy: validate update
AdmissionPolicy->>MachineAPI: check Machine, MachineSet, and CPMS references
AdmissionPolicy-->>Infrastructure: allow unused or unreferenced domain removal
AdmissionPolicy-->>Infrastructure: deny referenced domain removal
VAPSuite->>MachineAPI: delete blocking MachineSet
VAPSuite->>Infrastructure: retry failure-domain removal
Possibly related PRs
🚥 Pre-merge checks | ✅ 14 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (14 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-zones |
|
@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/81721120-7f9f-11f1-941e-018542fca9e5-0 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (3)
test/e2e/vsphere/failure_domain_vap.go (3)
34-48: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueLocal variable shadows builtin
copy.Naming the
DeepCopy()resultcopyshadows the built-incopy()function within this scope. Harmless here since the builtin isn't otherwise needed, but worth avoiding for clarity.♻️ Rename to avoid shadowing
- copy := infra.DeepCopy() - fds := copy.Spec.PlatformSpec.VSphere.FailureDomains + infraCopy := infra.DeepCopy() + fds := infraCopy.Spec.PlatformSpec.VSphere.FailureDomains filtered := fds[:0] for _, fd := range fds { if fd.Name != fdName { filtered = append(filtered, fd) } } - copy.Spec.PlatformSpec.VSphere.FailureDomains = filtered - return copy + infraCopy.Spec.PlatformSpec.VSphere.FailureDomains = filtered + return infraCopy🤖 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 34 - 48, Rename the DeepCopy() result local variable in infraWithFDRemoved from copy to a non-shadowing name, and update its subsequent references when accessing and assigning Spec.PlatformSpec.VSphere.FailureDomains. Preserve the existing filtering behavior.
234-234: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
defer GinkgoRecover()at the top of theDescribeclosure has no effect.This closure runs once during spec-tree construction, not during spec execution, so the deferred recover doesn't protect the
It/BeforeEachbodies where assertions actually run.GinkgoRecover()is only needed inside goroutines spawned from spec code; none are spawned in this file, so this line is effectively dead code.♻️ Remove the ineffective defer
func() { - defer GinkgoRecover() - ctx := context.Background()🤖 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` at line 234, Remove the ineffective defer GinkgoRecover() from the Describe closure in failure_domain_vap.go; no replacement is needed because this file does not spawn goroutines requiring recovery.
77-78: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRegion/zone label keys hardcoded and duplicated across the file.
The literal strings
"machine.openshift.io/region"and"machine.openshift.io/zone"are repeated at least seven times (lines 77-78, 120-121, 127-128, 214-215, 323-324, 334-335, 462-463). These same labels are read by the CEL-based VAPs inpkg/webhooks/vap.goviamachineRegionLabel/machineZoneLabelconstants. Duplicating the literals here risks silent drift (a typo just causes a Skip or a false pass instead of a compile error), and any future rename in the webhooks package would require finding every copy in this test file.Extract local package-level constants for these two labels and reference them everywhere in this file, mirroring the naming used in
pkg/webhooks/vap.goto make the coupling explicit.const ( machineRegionLabel = "machine.openshift.io/region" machineZoneLabel = "machine.openshift.io/zone" )Also applies to: 120-121, 127-128, 214-215, 323-324, 334-335, 462-463
🤖 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 77 - 78, Define package-level machineRegionLabel and machineZoneLabel constants in test/e2e/vsphere/failure_domain_vap.go, matching the values and names used by the VAP implementation, then replace every repeated region and zone label literal throughout the file with these constants.
🤖 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 379-380: Update the error assertions in the Machine and MachineSet
VAP tests to use their exact MessageExpression phrasing, such as “in use by
Machine '” and “in use by MachineSet '”, instead of the ambiguous “Machine” and
“MachineSet” substrings; leave the ControlPlaneMachineSet assertion unchanged.
- Around line 91-160: Update findFDUsedByCPMS to identify when its returned
failure domain comes from the worker-shared fallback rather than being
CPMS-only, and propagate that ambiguity to the callers around the CPMS admission
assertion. When no CPMS-only FD exists, skip or relax the expected
“ControlPlaneMachineSet” substring check while preserving the strict assertion
for an exclusive FD.
---
Nitpick comments:
In `@test/e2e/vsphere/failure_domain_vap.go`:
- Around line 34-48: Rename the DeepCopy() result local variable in
infraWithFDRemoved from copy to a non-shadowing name, and update its subsequent
references when accessing and assigning
Spec.PlatformSpec.VSphere.FailureDomains. Preserve the existing filtering
behavior.
- Line 234: Remove the ineffective defer GinkgoRecover() from the Describe
closure in failure_domain_vap.go; no replacement is needed because this file
does not spawn goroutines requiring recovery.
- Around line 77-78: Define package-level machineRegionLabel and
machineZoneLabel constants in test/e2e/vsphere/failure_domain_vap.go, matching
the values and names used by the VAP implementation, then replace every repeated
region and zone label literal throughout the file with these constants.
🪄 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: 692848d5-6190-4e89-856f-4cf264817a6a
📒 Files selected for processing (1)
test/e2e/vsphere/failure_domain_vap.go
|
/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-techpreview |
|
@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/452dd3d0-7fb7-11f1-8e5e-bc54849f548e-0 |
|
/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-techpreview-serial |
|
@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/4ed1bfe0-803f-11f1-8167-56a23068f085-0 |
|
/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-techpreview-serial |
|
@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/dc2a5e60-8071-11f1-9a77-28dff85f92fa-0 |
|
/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-zones-techpreview-serial |
|
@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/24aff3c0-8086-11f1-893c-057285f1f1ba-0 |
|
/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-zones-techpreview-serial |
|
@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/109449d0-8087-11f1-8dff-4e14e5580fac-0 |
|
/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-zones-techpreview-serial |
|
@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/784bddd0-810a-11f1-848a-fed249f82b6b-0 |
|
/unhold |
|
/lgtm |
|
@nrb: This PR has been marked as verified by 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. |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nrb 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 |
|
/retest |
|
@vr4manta: all tests passed! 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. |
SPLAT-2813
Changes
Summary by CodeRabbit