STOR-3065: Add storage CSI tests for cloning PVC to a larger volume - #31443
STOR-3065: Add storage CSI tests for cloning PVC to a larger volume#31443radeore wants to merge 1 commit into
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
|
@radeore: This pull request references STOR-3065 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "5.0.0" version, but no target version was set. 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. |
WalkthroughA new CSI extended suite tests cloning a source PVC into a larger filesystem or raw block PVC. Registration is guarded with ChangesCSI larger PVC clone
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant InitCSITests
participant testsuites.CSISuites
participant pvcCloneLargerCSISuite
participant KubernetesAPI
participant StorageClassTest
InitCSITests->>testsuites.CSISuites: RegisterAlwaysOnCSISuites
testsuites.CSISuites->>pvcCloneLargerCSISuite: append initializer once
pvcCloneLargerCSISuite->>KubernetesAPI: create source PVC and larger clone
KubernetesAPI-->>pvcCloneLargerCSISuite: report clone availability
pvcCloneLargerCSISuite->>StorageClassTest: validate cloned content with PvCheck
Suggested labels: Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error)
✅ Passed checks (14 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: radeore The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
test/extended/storage/csi/pvc_clone_larger.go (1)
26-31: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSuite name doesn't distinguish this suite from other clone suites.
Name: "OpenShift CSI extended - CSI Clone"feeds directly into generated Ginkgo test names. Something like"OpenShift CSI extended - CSI Clone Larger"keeps test IDs unambiguous and greppable if another clone suite is added later.🤖 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/storage/csi/pvc_clone_larger.go` around lines 26 - 31, Update the TestSuiteInfo.Name value in the CSI clone-larger suite to include a distinguishing “Larger” suffix, ensuring generated Ginkgo test names and IDs are unambiguous while leaving the existing test patterns unchanged.
🤖 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/storage/csi/pvc_clone_larger.go`:
- Around line 119-123: In the PVC clone sizing flow after retrieving sourcePVC,
validate that sourcePVC.Status.Capacity.Storage() is non-zero before creating
storageRequest. Fail the test with an explicit assertion if capacity is missing
or zero, then preserve the existing largerSize calculation for valid capacities.
---
Nitpick comments:
In `@test/extended/storage/csi/pvc_clone_larger.go`:
- Around line 26-31: Update the TestSuiteInfo.Name value in the CSI clone-larger
suite to include a distinguishing “Larger” suffix, ensuring generated Ginkgo
test names and IDs are unambiguous while leaving the existing test patterns
unchanged.
🪄 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: Pro Plus
Run ID: 5cf79345-5e21-47e3-a09a-81900b6afd35
📒 Files selected for processing (3)
pkg/clioptions/clusterdiscovery/csi.gotest/extended/storage/csi/csi.gotest/extended/storage/csi/pvc_clone_larger.go
| sourcePVC, err = cs.CoreV1().PersistentVolumeClaims(sourcePVC.Namespace).Get(ctx, sourcePVC.Name, metav1.GetOptions{}) | ||
| e2e.ExpectNoError(err, "Failed to get source PVC: %v", err) | ||
| storageRequest := resource.NewQuantity(sourcePVC.Status.Capacity.Storage().Value(), resource.BinarySI) | ||
| storageRequest.Add(resource.MustParse("1Gi")) | ||
| largerSize := storageRequest.String() |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Assert the source capacity is non-zero before deriving the clone size.
If Status.Capacity is missing (unbound/late-status PVC), Storage() yields 0 and largerSize silently becomes exactly 1Gi, so the test no longer verifies "larger than the source" — it may even request less than the source. A cheap guard keeps the intent explicit.
🛡️ Proposed guard
e2e.ExpectNoError(err, "Failed to get source PVC: %v", err)
- storageRequest := resource.NewQuantity(sourcePVC.Status.Capacity.Storage().Value(), resource.BinarySI)
+ sourceCapacity := sourcePVC.Status.Capacity.Storage().Value()
+ o.Expect(sourceCapacity).To(o.BeNumerically(">", 0), "source PVC has no reported capacity")
+ storageRequest := resource.NewQuantity(sourceCapacity, resource.BinarySI)
storageRequest.Add(resource.MustParse("1Gi"))📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| sourcePVC, err = cs.CoreV1().PersistentVolumeClaims(sourcePVC.Namespace).Get(ctx, sourcePVC.Name, metav1.GetOptions{}) | |
| e2e.ExpectNoError(err, "Failed to get source PVC: %v", err) | |
| storageRequest := resource.NewQuantity(sourcePVC.Status.Capacity.Storage().Value(), resource.BinarySI) | |
| storageRequest.Add(resource.MustParse("1Gi")) | |
| largerSize := storageRequest.String() | |
| sourcePVC, err = cs.CoreV1().PersistentVolumeClaims(sourcePVC.Namespace).Get(ctx, sourcePVC.Name, metav1.GetOptions{}) | |
| e2e.ExpectNoError(err, "Failed to get source PVC: %v", err) | |
| sourceCapacity := sourcePVC.Status.Capacity.Storage().Value() | |
| o.Expect(sourceCapacity).To(o.BeNumerically(">", 0), "source PVC has no reported capacity") | |
| storageRequest := resource.NewQuantity(sourceCapacity, resource.BinarySI) | |
| storageRequest.Add(resource.MustParse("1Gi")) | |
| largerSize := storageRequest.String() |
🤖 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/storage/csi/pvc_clone_larger.go` around lines 119 - 123, In the
PVC clone sizing flow after retrieving sourcePVC, validate that
sourcePVC.Status.Capacity.Storage() is non-zero before creating storageRequest.
Fail the test with an explicit assertion if capacity is missing or zero, then
preserve the existing largerSize calculation for valid capacities.
|
Scheduling required tests: |
|
@radeore: The following test failed, say
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. |
|
Risk analysis has seen new tests most likely introduced by this PR. New Test Risks for sha: cb36e46
New tests seen in this PR at sha: cb36e46
|
Summary
Test plan
Summary by CodeRabbit
New Features
Bug Fixes