Skip to content

Automate OCP-89594-Verify LVMCluster deviceDiscoveryPolicy is configu…#2758

Open
mmakwana30 wants to merge 1 commit into
openshift:mainfrom
mmakwana30:OCP-89594
Open

Automate OCP-89594-Verify LVMCluster deviceDiscoveryPolicy is configu…#2758
mmakwana30 wants to merge 1 commit into
openshift:mainfrom
mmakwana30:OCP-89594

Conversation

@mmakwana30

@mmakwana30 mmakwana30 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

…rable

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of LVMCluster restoration and recreation during disruptive scenarios.
    • Strengthened validation of device discovery policy transitions (Static→Dynamic→Static), excluded-device reporting, and VG/device preservation and cleanup behavior.
  • Tests
    • Updated integration tests to generate and apply LVMCluster configurations from manifests, with safer apply behavior and fallback handling.
    • Refined step ordering and assertions to more accurately verify runtime policy transitions and related cleanup outcomes.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@mmakwana30, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 41 minutes. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: b3b65933-8c4f-4b19-9822-3b14ef110bcc

📥 Commits

Reviewing files that changed from the base of the PR and between 7b83924 and 8d84f64.

📒 Files selected for processing (1)
  • test/integration/qe_tests/lvms.go

Walkthrough

Test helpers now apply LVMCluster manifests with server-side fallback, and disruptive integration tests recreate saved clusters through the manifest helper. The deviceDiscoveryPolicy scenario also updates runtime transition checks and excluded-device assertions.

Changes

LVMS manifest recreation and policy transitions

Layer / File(s) Summary
Shared manifest apply helper
test/integration/qe_tests/lvms_utils.go
Helper constructors and the shared apply path now build YAML and apply LVMCluster manifests with server-side conflict forcing plus fallback.
Disruptive restoration paths
test/integration/qe_tests/lvms.go
Disruptive scenarios recreate saved LVMCluster resources through the manifest helper during deferred restoration and cleanup steps.
Device discovery policy transitions
test/integration/qe_tests/lvms.go
The deviceDiscoveryPolicy scenario updates excluded-device assertions, verifies RuntimeStatic and RuntimeDynamic transitions, and checks VG device preservation and cleanup around restoration.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • openshift/lvm-operator#2709: Updates the deviceDiscoveryPolicy runtime-transition test and manifest-based cluster recreation in the same area.

Suggested labels

ready-for-human-review

Suggested reviewers

  • jaypoulz
  • suleymanakbas91
  • pacevedom
🚥 Pre-merge checks | ✅ 13 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Structure And Quality ⚠️ Warning The new deviceDiscoveryPolicy It block mixes creation, validation, transitions, and restoration, and most error checks are bare Expect(err).NotTo(HaveOccurred()). Split it into smaller Its/contexts and add contextual failure messages to the error assertions.
✅ 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 clearly matches the main change: automating verification that LVMCluster deviceDiscoveryPolicy is configurable.
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 only new/changed Ginkgo title is a static literal; no g.It/Describe/Context/When calls use fmt.Sprintf or other dynamic data.
Microshift Test Compatibility ✅ Passed The updated test uses only LVMS CRDs and plain Kubernetes resources; no forbidden OpenShift APIs, namespaces, or MicroShift-specific unsupported assumptions are introduced.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The changed test is SNO-labeled and only requires worker-labeled nodes plus free disks; it never requires >1 nodes or HA-specific behavior.
Topology-Aware Scheduling Compatibility ✅ Passed Only LVMS test helpers/scenarios changed; no new pod affinity, topology spread, control-plane nodeSelector, taints, or replica logic was introduced.
Ote Binary Stdout Contract ✅ Passed PASS: Process-level init routes klog to GinkgoWriter and no stdout prints/logging were added in main/setup code.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The changed deviceDiscoveryPolicy test only uses oc/K8s APIs and disk paths; no IPv4 literals, IP parsing, host URLs, or external connectivity were added.
No-Weak-Crypto ✅ Passed Touched files only build YAML/oc apply and test state checks; no weak crypto APIs or secret/token comparisons found in modified files.
Container-Privileges ✅ Passed Changed files only swap JSON→manifest helpers in Go tests; no added privileged/hostPID/hostIPC/allowPrivilegeEscalation/SYS_ADMIN settings were introduced.
No-Sensitive-Data-In-Logs ✅ Passed Changed code only logs generic status/output; no new secrets, PII, tokens, or hostnames are logged in the modified test/helper paths.
✨ 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 added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 25, 2026
@openshift-ci openshift-ci Bot requested review from jerpeter1 and qJkee June 25, 2026 11:45
@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mmakwana30
Once this PR has been reviewed and has the lgtm label, please assign jaypoulz 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 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/integration/qe_tests/lvms_utils.go (1)

803-817: 🗄️ Data Integrity & Integration | 🟠 Major

Sanitize exported JSON fields before applying

Raw server-side fields (specifically status, uid, resourceVersion, and managedFields) passed in the manifest cause conflicts or validation errors, even with the fallback client-side apply. The input JSON must be stripped of these server-owned keys before execution.

🤖 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/integration/qe_tests/lvms_utils.go` around lines 803 - 817, The
createLVMClusterFromManifest flow still passes exported JSON with server-owned
fields through both apply paths, so sanitize the manifest before calling oc
apply. In createLVMClusterFromManifest, strip status, uid, resourceVersion, and
managedFields from the input manifest first, then use the cleaned manifest for
both the server-side and fallback client-side apply commands so the function no
longer feeds invalid server-managed data to oc.
🧹 Nitpick comments (1)
test/integration/qe_tests/lvms_utils.go (1)

806-812: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Bound both oc apply calls with a timeout.

Use exec.CommandContext for the SSA attempt and fallback so a stuck CLI/API call does not hang the serial disruptive suite.

As per path instructions, **/*.go: context.Context for cancellation and timeouts.

🤖 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/integration/qe_tests/lvms_utils.go` around lines 806 - 812, Both oc
apply invocations in the apply-manifest flow are unbounded and can hang the
serial suite; update the logic around the existing exec.Command calls to use
exec.CommandContext with a context that has a timeout for both the server-side
apply attempt and the fallback apply. Make sure the context is created in the
surrounding helper before calling the apply commands, and that both command
paths in this function use the same cancellation/timeout handling so a stuck CLI
or API call cannot block the run.

Source: Path instructions

🤖 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/integration/qe_tests/lvms.go`:
- Line 564: Handle the restore calls in the cleanup defers so their errors are
not silently discarded; update each createLVMClusterFromManifest(...) use in the
affected deferred cleanup blocks to capture the returned error and either log it
with context or fail cleanup explicitly, following the same pattern across the
repeated restore sites in qe_tests/lvms.go.
- Around line 5859-5866: The VG cleanup check in the eventual assertion
currently treats any `oc get` error as success, which can mask transient
failures. Update the retry logic around the `exec.Command("oc", "get",
"lvmvolumegroup", ...)` call so that command errors are logged and return false
to keep retrying, and only return true when the `CombinedOutput` succeeds and
the trimmed output is actually empty. Keep the behavior localized to the
`Eventually` block in `lvms.go`.
- Line 5832: The test setup for createLVMClusterFromManifest should register
failure-path cleanup for test-lvmcluster-89594 as soon as newLVMClusterName and
deviceClassName are initialized. Add an immediate defer in this setup block to
delete the temporary LVMCluster on failure before any later assertions run, so
the existing restore defer in the surrounding test does not leave the temporary
resource behind.

---

Outside diff comments:
In `@test/integration/qe_tests/lvms_utils.go`:
- Around line 803-817: The createLVMClusterFromManifest flow still passes
exported JSON with server-owned fields through both apply paths, so sanitize the
manifest before calling oc apply. In createLVMClusterFromManifest, strip status,
uid, resourceVersion, and managedFields from the input manifest first, then use
the cleaned manifest for both the server-side and fallback client-side apply
commands so the function no longer feeds invalid server-managed data to oc.

---

Nitpick comments:
In `@test/integration/qe_tests/lvms_utils.go`:
- Around line 806-812: Both oc apply invocations in the apply-manifest flow are
unbounded and can hang the serial suite; update the logic around the existing
exec.Command calls to use exec.CommandContext with a context that has a timeout
for both the server-side apply attempt and the fallback apply. Make sure the
context is created in the surrounding helper before calling the apply commands,
and that both command paths in this function use the same cancellation/timeout
handling so a stuck CLI or API call cannot block the run.
🪄 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: 0e870db2-2132-482f-9ae3-da9a4672d852

📥 Commits

Reviewing files that changed from the base of the PR and between bdda898 and 417f81f.

📒 Files selected for processing (2)
  • test/integration/qe_tests/lvms.go
  • test/integration/qe_tests/lvms_utils.go

Comment thread test/integration/qe_tests/lvms.go Outdated
Comment thread test/integration/qe_tests/lvms.go Outdated
Comment thread test/integration/qe_tests/lvms.go
@codecov-commenter

codecov-commenter commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.14%. Comparing base (bdda898) to head (8d84f64).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2758      +/-   ##
==========================================
+ Coverage   53.03%   54.14%   +1.11%     
==========================================
  Files          53       54       +1     
  Lines        4033     4170     +137     
==========================================
+ Hits         2139     2258     +119     
- Misses       1723     1730       +7     
- Partials      171      182      +11     

see 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jun 25, 2026
@openshift-ci openshift-ci Bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 26, 2026
@mmakwana30

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-single-node

1 similar comment
@mmakwana30

Copy link
Copy Markdown
Contributor Author

/test e2e-aws-single-node

@openshift-ci

openshift-ci Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

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

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

Labels

ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants