diff --git a/test/e2e/storage/testsuites/snapshottable.go b/test/e2e/storage/testsuites/snapshottable.go index b21eb678d20..78c390f4e1d 100644 --- a/test/e2e/storage/testsuites/snapshottable.go +++ b/test/e2e/storage/testsuites/snapshottable.go @@ -207,7 +207,7 @@ func (s *snapshottableTestSuite) DefineTests(driver TestDriver, pattern testpatt vscontent = sr.Vscontent vsc = sr.Vsclass }) - ginkgo.It("should create snapshot objects correctly and delete according to its deletion policy", func() { + ginkgo.It("should check snapshot fields, check restore correctly works after modifying source data, check deletion", func() { ginkgo.By("checking the snapshot") // Get new copy of the snapshot vs, err = dc.Resource(SnapshotGVR).Namespace(vs.GetNamespace()).Get(context.TODO(), vs.GetName(), metav1.GetOptions{}) @@ -231,22 +231,7 @@ func (s *snapshottableTestSuite) DefineTests(driver TestDriver, pattern testpatt framework.ExpectEqual(volumeSnapshotRef["name"], vs.GetName()) framework.ExpectEqual(volumeSnapshotRef["namespace"], vs.GetNamespace()) - ginkgo.By("should delete the VolumeSnapshotContent according to its deletion policy") - err = DeleteAndWaitSnapshot(dc, vs.GetNamespace(), vs.GetName(), framework.Poll, framework.SnapshotDeleteTimeout) - framework.ExpectNoError(err) - - switch pattern.SnapshotDeletionPolicy { - case testpatterns.DeleteSnapshot: - ginkgo.By("checking the SnapshotContent has been deleted") - err = utils.WaitForGVRDeletion(dc, SnapshotContentGVR, vscontent.GetName(), framework.Poll, framework.SnapshotDeleteTimeout) - framework.ExpectNoError(err) - case testpatterns.RetainSnapshot: - ginkgo.By("checking the SnapshotContent has not been deleted") - err = utils.WaitForGVRDeletion(dc, SnapshotContentGVR, vscontent.GetName(), 1*time.Second /* poll */, 30*time.Second /* timeout */) - framework.ExpectError(err) - } - }) - ginkgo.It("should restore from snapshot with saved data after modifying source data", func() { + ginkgo.By("Modifying source data test") var restoredPVC *v1.PersistentVolumeClaim var restoredPod *v1.Pod modifiedMntTestData := fmt.Sprintf("modified data from %s namespace", pvc.GetNamespace()) @@ -293,6 +278,21 @@ func (s *snapshottableTestSuite) DefineTests(driver TestDriver, pattern testpatt actualData, err := utils.PodExec(f, restoredPod, command) framework.ExpectNoError(err) framework.ExpectEqual(actualData, originalMntTestData) + + ginkgo.By("should delete the VolumeSnapshotContent according to its deletion policy") + err = DeleteAndWaitSnapshot(dc, vs.GetNamespace(), vs.GetName(), framework.Poll, framework.SnapshotDeleteTimeout) + framework.ExpectNoError(err) + + switch pattern.SnapshotDeletionPolicy { + case testpatterns.DeleteSnapshot: + ginkgo.By("checking the SnapshotContent has been deleted") + err = utils.WaitForGVRDeletion(dc, SnapshotContentGVR, vscontent.GetName(), framework.Poll, framework.SnapshotDeleteTimeout) + framework.ExpectNoError(err) + case testpatterns.RetainSnapshot: + ginkgo.By("checking the SnapshotContent has not been deleted") + err = utils.WaitForGVRDeletion(dc, SnapshotContentGVR, vscontent.GetName(), 1*time.Second /* poll */, 30*time.Second /* timeout */) + framework.ExpectError(err) + } }) }) })