e2e: validate pvc-pvc clone in ec pool

Validate pvc to pvc clone in erasure
coded pools.

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

View File

@ -515,6 +515,27 @@ var _ = Describe("RBD", func() {
f) f)
}) })
By("create an erasure coded PVC and validate PVC-PVC clone", func() {
validatePVCClone(
defaultCloneCount,
pvcPath,
appPath,
pvcSmartClonePath,
appSmartClonePath,
erasureCodedPool,
noKMS,
noPVCValidation,
f)
err := deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil {
e2elog.Failf("failed to delete storageclass: %v", err)
}
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, nil, deletePolicy)
if err != nil {
e2elog.Failf("failed to create storageclass: %v", err)
}
})
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() {
err := deleteResource(rbdExamplePath + "storageclass.yaml") err := deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
@ -1536,6 +1557,7 @@ var _ = Describe("RBD", func() {
appPath, appPath,
pvcSmartClonePath, pvcSmartClonePath,
appSmartClonePath, appSmartClonePath,
noDataPool,
noKMS, noKMS,
noPVCValidation, noPVCValidation,
f) f)
@ -1553,7 +1575,15 @@ var _ = Describe("RBD", func() {
e2elog.Failf("failed to create storageclass: %v", err) e2elog.Failf("failed to create storageclass: %v", err)
} }
validatePVCClone(1, pvcPath, appPath, pvcSmartClonePath, appSmartClonePath, noKMS, isThickPVC, f) validatePVCClone(1,
pvcPath,
appPath,
pvcSmartClonePath,
appSmartClonePath,
noDataPool,
noKMS,
isThickPVC,
f)
err = deleteResource(rbdExamplePath + "storageclass.yaml") err = deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
@ -1732,7 +1762,15 @@ var _ = Describe("RBD", func() {
e2elog.Failf("failed to create storageclass: %v", err) e2elog.Failf("failed to create storageclass: %v", err)
} }
validatePVCClone(1, pvcPath, appPath, pvcSmartClonePath, appSmartClonePath, secretsMetadataKMS, isEncryptedPVC, f) validatePVCClone(1,
pvcPath,
appPath,
pvcSmartClonePath,
appSmartClonePath,
noDataPool,
secretsMetadataKMS,
isEncryptedPVC,
f)
err = deleteResource(rbdExamplePath + "storageclass.yaml") err = deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
@ -1758,7 +1796,15 @@ var _ = Describe("RBD", func() {
e2elog.Failf("failed to create storageclass: %v", err) e2elog.Failf("failed to create storageclass: %v", err)
} }
validatePVCClone(1, pvcPath, appPath, pvcSmartClonePath, appSmartClonePath, vaultKMS, isEncryptedPVC, f) validatePVCClone(1,
pvcPath,
appPath,
pvcSmartClonePath,
appSmartClonePath,
noDataPool,
vaultKMS,
isEncryptedPVC,
f)
err = deleteResource(rbdExamplePath + "storageclass.yaml") err = deleteResource(rbdExamplePath + "storageclass.yaml")
if err != nil { if err != nil {
@ -1787,6 +1833,7 @@ var _ = Describe("RBD", func() {
rawAppPath, rawAppPath,
pvcBlockSmartClonePath, pvcBlockSmartClonePath,
appBlockSmartClonePath, appBlockSmartClonePath,
noDataPool,
noKMS, noKMS,
noPVCValidation, noPVCValidation,
f) f)

View File

@ -594,7 +594,8 @@ func writeDataAndCalChecksum(app *v1.Pod, opt *metav1.ListOptions, f *framework.
// nolint:gocyclo,gocognit,nestif,cyclop // reduce complexity // nolint:gocyclo,gocognit,nestif,cyclop // reduce complexity
func validatePVCClone( func validatePVCClone(
totalCount int, totalCount int,
sourcePvcPath, sourceAppPath, clonePvcPath, clonePvcAppPath string, sourcePvcPath, sourceAppPath, clonePvcPath, clonePvcAppPath,
dataPool string,
kms kmsConfig, kms kmsConfig,
validatePVC validateFunc, validatePVC validateFunc,
f *framework.Framework) { f *framework.Framework) {
@ -662,6 +663,9 @@ func validatePVCClone(
LabelSelector: fmt.Sprintf("%s=%s", appKey, label[appKey]), LabelSelector: fmt.Sprintf("%s=%s", appKey, label[appKey]),
} }
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)
}
if wgErrs[n] == nil && kms != noKMS { if wgErrs[n] == nil && kms != noKMS {
if kms.canGetPassphrase() { if kms.canGetPassphrase() {
imageData, sErr := getImageInfoFromPVC(p.Namespace, name, f) imageData, sErr := getImageInfoFromPVC(p.Namespace, name, f)