e2e: validate snapshot restore in ec pool

validate snapshot restore in erasure coded
pool.

Signed-off-by: Yug Gupta <yuggupta27@gmail.com>
This commit is contained in:
Yug Gupta 2021-10-27 13:52:50 +05:30 committed by mergify[bot]
parent 34c37663c2
commit 938051463f
2 changed files with 25 additions and 14 deletions

View File

@ -38,6 +38,7 @@ var (
rbdDaemonsetName = "csi-rbdplugin" rbdDaemonsetName = "csi-rbdplugin"
defaultRBDPool = "replicapool" defaultRBDPool = "replicapool"
erasureCodedPool = "ec-pool" erasureCodedPool = "ec-pool"
noDataPool = ""
// Topology related variables. // Topology related variables.
nodeRegionLabel = "test.failure-domain/region" nodeRegionLabel = "test.failure-domain/region"
regionValue = "testregion" regionValue = "testregion"
@ -498,14 +499,20 @@ var _ = Describe("RBD", func() {
} }
// validate created backend rbd images // validate created backend rbd images
validateRBDImageCount(f, 0, defaultRBDPool) validateRBDImageCount(f, 0, defaultRBDPool)
err = deleteResource(rbdExamplePath + "storageclass.yaml") })
if err != nil {
e2elog.Failf("failed to delete storageclass with error %v", err) By("create an erasure coded PVC and validate snapshot restore", func() {
} validatePVCSnapshot(
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, nil, deletePolicy) defaultCloneCount,
if err != nil { pvcPath,
e2elog.Failf("failed to create storageclass with error %v", err) 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() { 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, appClonePath,
noKMS, noKMS, noKMS, noKMS,
defaultSCName, defaultSCName,
noDataPool,
f) f)
}) })
@ -1574,7 +1582,7 @@ var _ = Describe("RBD", func() {
validatePVCSnapshot(1, validatePVCSnapshot(1,
pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath,
vaultKMS, vaultKMS, vaultKMS, vaultKMS,
defaultSCName, defaultSCName, noDataPool,
f) f)
err = deleteResource(rbdExamplePath + "storageclass.yaml") err = deleteResource(rbdExamplePath + "storageclass.yaml")
@ -1620,7 +1628,7 @@ var _ = Describe("RBD", func() {
validatePVCSnapshot(1, validatePVCSnapshot(1,
pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath,
vaultKMS, vaultTenantSAKMS, vaultKMS, vaultTenantSAKMS,
restoreSCName, f) restoreSCName, noDataPool, f)
err = retryKubectlArgs(cephCSINamespace, kubectlDelete, deployTimeout, "storageclass", restoreSCName) err = retryKubectlArgs(cephCSINamespace, kubectlDelete, deployTimeout, "storageclass", restoreSCName)
if err != nil { if err != nil {
@ -1679,7 +1687,7 @@ var _ = Describe("RBD", func() {
validatePVCSnapshot(1, validatePVCSnapshot(1,
pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath,
vaultKMS, secretsMetadataKMS, vaultKMS, secretsMetadataKMS,
restoreSCName, f) restoreSCName, noDataPool, f)
// delete user secret // delete user secret
err = retryKubectlFile(namespace, err = retryKubectlFile(namespace,

View File

@ -802,9 +802,8 @@ func validatePVCClone(
func validatePVCSnapshot( func validatePVCSnapshot(
totalCount int, totalCount int,
pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath string, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath string,
kms, restoreKMS kmsConfig, kms, restoreKMS kmsConfig, restoreSCName,
restoreSCName string, dataPool string, f *framework.Framework) {
f *framework.Framework) {
var wg sync.WaitGroup var wg sync.WaitGroup
wgErrs := make([]error, totalCount) wgErrs := make([]error, totalCount)
chErrs := make([]error, totalCount) chErrs := make([]error, totalCount)
@ -1020,6 +1019,10 @@ func validatePVCSnapshot(
name := fmt.Sprintf("%s%d", f.UniqueName, n) name := fmt.Sprintf("%s%d", f.UniqueName, n)
p.Spec.DataSource.Name = name p.Spec.DataSource.Name = name
wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout) wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout)
if wgErrs[n] == nil && dataPool != noDataPool {
wgErrs[n] = checkPVCDataPoolForImageInPool(f, &p, defaultRBDPool, dataPool)
}
wg.Done() wg.Done()
}(i, *pvcClone, *appClone) }(i, *pvcClone, *appClone)
} }