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"
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,

View File

@ -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)
}