mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
e2e: modify validatePVCSnapshot() to use restoreSCName & restoreKMS
Signed-off-by: Rakshith R <rar@redhat.com>
(cherry picked from commit f63ed2ca5a
)
This commit is contained in:
parent
9ae00de979
commit
a781ebb844
@ -930,7 +930,8 @@ var _ = Describe("RBD", func() {
|
||||
snapshotPath,
|
||||
pvcClonePath,
|
||||
appClonePath,
|
||||
noKMS,
|
||||
noKMS, noKMS,
|
||||
defaultSCName,
|
||||
f)
|
||||
}
|
||||
})
|
||||
@ -997,7 +998,11 @@ var _ = Describe("RBD", func() {
|
||||
e2elog.Failf("failed to create storageclass with error %v", err)
|
||||
}
|
||||
|
||||
validatePVCSnapshot(1, pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath, vaultKMS, f)
|
||||
validatePVCSnapshot(1,
|
||||
pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath,
|
||||
vaultKMS, vaultKMS,
|
||||
defaultSCName,
|
||||
f)
|
||||
|
||||
err = deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||
if err != nil {
|
||||
|
29
e2e/utils.go
29
e2e/utils.go
@ -733,7 +733,8 @@ func validatePVCClone(
|
||||
func validatePVCSnapshot(
|
||||
totalCount int,
|
||||
pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath string,
|
||||
kms kmsConfig,
|
||||
kms, restoreKMS kmsConfig,
|
||||
restoreSCName string,
|
||||
f *framework.Framework) {
|
||||
var wg sync.WaitGroup
|
||||
wgErrs := make([]error, totalCount)
|
||||
@ -834,6 +835,9 @@ func validatePVCSnapshot(
|
||||
pvcClone.Namespace = f.UniqueName
|
||||
appClone.Namespace = f.UniqueName
|
||||
pvcClone.Spec.DataSource.Name = fmt.Sprintf("%s%d", f.UniqueName, 0)
|
||||
if restoreSCName != "" {
|
||||
pvcClone.Spec.StorageClassName = &restoreSCName
|
||||
}
|
||||
|
||||
// create multiple PVC from same snapshot
|
||||
wg.Add(totalCount)
|
||||
@ -847,6 +851,26 @@ func validatePVCSnapshot(
|
||||
LabelSelector: fmt.Sprintf("%s=%s", appKey, label[appKey]),
|
||||
}
|
||||
wgErrs[n] = createPVCAndApp(name, f, &p, &a, deployTimeout)
|
||||
if wgErrs[n] == nil && restoreKMS != noKMS {
|
||||
if restoreKMS.canGetPassphrase() {
|
||||
imageData, sErr := getImageInfoFromPVC(p.Namespace, name, f)
|
||||
if sErr != nil {
|
||||
wgErrs[n] = fmt.Errorf(
|
||||
"failed to get image info for %s namespace=%s volumehandle=%s error=%w",
|
||||
name,
|
||||
p.Namespace,
|
||||
imageData.csiVolumeHandle,
|
||||
sErr)
|
||||
} else {
|
||||
// check new passphrase created
|
||||
_, stdErr := restoreKMS.getPassphrase(f, imageData.csiVolumeHandle)
|
||||
if stdErr != "" {
|
||||
wgErrs[n] = fmt.Errorf("failed to read passphrase from vault: %s", stdErr)
|
||||
}
|
||||
}
|
||||
}
|
||||
wgErrs[n] = isEncryptedPVC(f, &p, &a)
|
||||
}
|
||||
if wgErrs[n] == nil {
|
||||
filePath := a.Spec.Containers[0].VolumeMounts[0].MountPath + "/test"
|
||||
var checkSumClone string
|
||||
@ -863,9 +887,6 @@ func validatePVCSnapshot(
|
||||
checkSumClone)
|
||||
}
|
||||
}
|
||||
if wgErrs[n] == nil && kms != noKMS {
|
||||
wgErrs[n] = isEncryptedPVC(f, &p, &a)
|
||||
}
|
||||
wg.Done()
|
||||
}(i, *pvcClone, *appClone)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user