From 938051463fc3f22c09020d7fe08aac18e8d958d2 Mon Sep 17 00:00:00 2001 From: Yug Gupta Date: Wed, 27 Oct 2021 13:52:50 +0530 Subject: [PATCH] e2e: validate snapshot restore in ec pool validate snapshot restore in erasure coded pool. Signed-off-by: Yug Gupta --- e2e/rbd.go | 30 +++++++++++++++++++----------- e2e/utils.go | 9 ++++++--- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/e2e/rbd.go b/e2e/rbd.go index cce6ed5fb..3c703c00e 100644 --- a/e2e/rbd.go +++ b/e2e/rbd.go @@ -38,6 +38,7 @@ var ( rbdDaemonsetName = "csi-rbdplugin" defaultRBDPool = "replicapool" erasureCodedPool = "ec-pool" + noDataPool = "" // Topology related variables. nodeRegionLabel = "test.failure-domain/region" regionValue = "testregion" @@ -498,14 +499,20 @@ var _ = Describe("RBD", func() { } // validate created backend rbd images validateRBDImageCount(f, 0, defaultRBDPool) - err = deleteResource(rbdExamplePath + "storageclass.yaml") - if err != nil { - e2elog.Failf("failed to delete storageclass with error %v", err) - } - err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, nil, deletePolicy) - if err != nil { - e2elog.Failf("failed to create storageclass with error %v", err) - } + }) + + By("create an erasure coded PVC and validate snapshot restore", func() { + validatePVCSnapshot( + defaultCloneCount, + pvcPath, + appPath, + snapshotPath, + pvcClonePath, + appClonePath, + noKMS, noKMS, + defaultSCName, + erasureCodedPool, + f) }) By("create a PVC and bind it to an app with ext4 as the FS ", func() { @@ -1518,6 +1525,7 @@ var _ = Describe("RBD", func() { appClonePath, noKMS, noKMS, defaultSCName, + noDataPool, f) }) @@ -1574,7 +1582,7 @@ var _ = Describe("RBD", func() { validatePVCSnapshot(1, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath, vaultKMS, vaultKMS, - defaultSCName, + defaultSCName, noDataPool, f) err = deleteResource(rbdExamplePath + "storageclass.yaml") @@ -1620,7 +1628,7 @@ var _ = Describe("RBD", func() { validatePVCSnapshot(1, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath, vaultKMS, vaultTenantSAKMS, - restoreSCName, f) + restoreSCName, noDataPool, f) err = retryKubectlArgs(cephCSINamespace, kubectlDelete, deployTimeout, "storageclass", restoreSCName) if err != nil { @@ -1679,7 +1687,7 @@ var _ = Describe("RBD", func() { validatePVCSnapshot(1, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath, vaultKMS, secretsMetadataKMS, - restoreSCName, f) + restoreSCName, noDataPool, f) // delete user secret err = retryKubectlFile(namespace, diff --git a/e2e/utils.go b/e2e/utils.go index 9af1a42a6..ff295f044 100644 --- a/e2e/utils.go +++ b/e2e/utils.go @@ -802,9 +802,8 @@ func validatePVCClone( func validatePVCSnapshot( totalCount int, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath string, - kms, restoreKMS kmsConfig, - restoreSCName string, - f *framework.Framework) { + kms, restoreKMS kmsConfig, restoreSCName, + dataPool string, f *framework.Framework) { var wg sync.WaitGroup wgErrs := make([]error, totalCount) chErrs := make([]error, totalCount) @@ -1020,6 +1019,10 @@ func validatePVCSnapshot( name := fmt.Sprintf("%s%d", f.UniqueName, n) p.Spec.DataSource.Name = name wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout) + if wgErrs[n] == nil && dataPool != noDataPool { + wgErrs[n] = checkPVCDataPoolForImageInPool(f, &p, defaultRBDPool, dataPool) + } + wg.Done() }(i, *pvcClone, *appClone) }