-
Notifications
You must be signed in to change notification settings - Fork 41.7k
test: add snapshot deletion source volume verification test #135288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
test: add snapshot deletion source volume verification test #135288
Conversation
Add a new E2E test to verify that deleting a VolumeSnapshot does not delete the source PVC and PV. The test: - Creates a snapshot of a persistent volume - Deletes the snapshot - Verifies that the source PVC and PV still exist - Verifies that the original data is intact - Verifies that the volume is still writable This test covers both delete and retain snapshot deletion policies for dynamic and pre-provisioned snapshots.
|
Welcome @duanwei33! |
|
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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. |
|
Hi @duanwei33. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: duanwei33 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
| // Verify that the original PVC and PV still exist | ||
| ginkgo.By("verifying the source PVC still exists after snapshot deletion") | ||
| pvc, err = cs.CoreV1().PersistentVolumeClaims(pvc.Namespace).Get(ctx, pvc.Name, metav1.GetOptions{}) | ||
| framework.ExpectNoError(err, "source PVC should still exist after snapshot deletion") | ||
| gomega.Expect(pvc.Status.Phase).To(gomega.Equal(v1.ClaimBound), "source PVC should still be in Bound state") | ||
|
|
||
| ginkgo.By("verifying the source PV still exists after snapshot deletion") | ||
| pv, err = cs.CoreV1().PersistentVolumes().Get(ctx, originalPVName, metav1.GetOptions{}) | ||
| framework.ExpectNoError(err, "source PV should still exist after snapshot deletion") | ||
| gomega.Expect(pv.Name).To(gomega.Equal(originalPVName), "source PV name should match the original") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Verify that the original PVC and PV still exist | |
| ginkgo.By("verifying the source PVC still exists after snapshot deletion") | |
| pvc, err = cs.CoreV1().PersistentVolumeClaims(pvc.Namespace).Get(ctx, pvc.Name, metav1.GetOptions{}) | |
| framework.ExpectNoError(err, "source PVC should still exist after snapshot deletion") | |
| gomega.Expect(pvc.Status.Phase).To(gomega.Equal(v1.ClaimBound), "source PVC should still be in Bound state") | |
| ginkgo.By("verifying the source PV still exists after snapshot deletion") | |
| pv, err = cs.CoreV1().PersistentVolumes().Get(ctx, originalPVName, metav1.GetOptions{}) | |
| framework.ExpectNoError(err, "source PV should still exist after snapshot deletion") | |
| gomega.Expect(pv.Name).To(gomega.Equal(originalPVName), "source PV name should match the original") |
From my understanding, the origin bug clean up the under layer origin volume by mistake. It seems there's no chance the snapshot controller/snappshotter will delete pvc/pv, so maybe we could omit these even though it is no harm.
| ginkgo.By("verifying original data still exists in the volume") | ||
| readCmd := e2evolume.GenerateReadFileCmd(datapath) | ||
| _, err = e2eoutput.LookForStringInPodExec(verifyPod.Namespace, verifyPod.Name, readCmd, originalMntTestData, time.Minute) | ||
| framework.ExpectNoError(err, "original data should still be present in the volume") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| framework.ExpectNoError(err, "original data should still be present in the volume") | |
| framework.ExpectNoError(err, "original data is not present in the volume") |
Maybe better.
| ginkgo.By("[init] deleting the pod") | ||
| StopPod(ctx, cs, pod) | ||
|
|
||
| // Wait for volume to be fully detached from the node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment better to move before line:445, it seems a bit mislead here.
|
/release-note-none |
|
nit: keep consistent with the example release-note in description could help the bot add the correct Does this PR introduce a user-facing change? |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Add a new E2E test to verify that deleting a VolumeSnapshot does not delete the source PVC and PV.
The test:
This test covers both delete and retain snapshot deletion policies for dynamic and pre-provisioned snapshots."
Which issue(s) this PR is related to:
It could detect issues like https://issues.redhat.com/browse/OCPBUGS-62096
Does this PR introduce a user-facing change?
No
Execution
Ran 4 of 7552 Specs in 279.269 seconds
SUCCESS! -- 4 Passed | 0 Failed | 0 Pending | 7548 Skipped
Resource will be cleaned up after test: