mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-30 10:10:21 +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,
|
snapshotPath,
|
||||||
pvcClonePath,
|
pvcClonePath,
|
||||||
appClonePath,
|
appClonePath,
|
||||||
noKMS,
|
noKMS, noKMS,
|
||||||
|
defaultSCName,
|
||||||
f)
|
f)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -997,7 +998,11 @@ var _ = Describe("RBD", func() {
|
|||||||
e2elog.Failf("failed to create storageclass with error %v", err)
|
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")
|
err = deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
29
e2e/utils.go
29
e2e/utils.go
@ -733,7 +733,8 @@ func validatePVCClone(
|
|||||||
func validatePVCSnapshot(
|
func validatePVCSnapshot(
|
||||||
totalCount int,
|
totalCount int,
|
||||||
pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath string,
|
pvcPath, appPath, snapshotPath, pvcClonePath, appClonePath string,
|
||||||
kms kmsConfig,
|
kms, restoreKMS kmsConfig,
|
||||||
|
restoreSCName string,
|
||||||
f *framework.Framework) {
|
f *framework.Framework) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
wgErrs := make([]error, totalCount)
|
wgErrs := make([]error, totalCount)
|
||||||
@ -834,6 +835,9 @@ func validatePVCSnapshot(
|
|||||||
pvcClone.Namespace = f.UniqueName
|
pvcClone.Namespace = f.UniqueName
|
||||||
appClone.Namespace = f.UniqueName
|
appClone.Namespace = f.UniqueName
|
||||||
pvcClone.Spec.DataSource.Name = fmt.Sprintf("%s%d", f.UniqueName, 0)
|
pvcClone.Spec.DataSource.Name = fmt.Sprintf("%s%d", f.UniqueName, 0)
|
||||||
|
if restoreSCName != "" {
|
||||||
|
pvcClone.Spec.StorageClassName = &restoreSCName
|
||||||
|
}
|
||||||
|
|
||||||
// create multiple PVC from same snapshot
|
// create multiple PVC from same snapshot
|
||||||
wg.Add(totalCount)
|
wg.Add(totalCount)
|
||||||
@ -847,6 +851,26 @@ func validatePVCSnapshot(
|
|||||||
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 && 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 {
|
if wgErrs[n] == nil {
|
||||||
filePath := a.Spec.Containers[0].VolumeMounts[0].MountPath + "/test"
|
filePath := a.Spec.Containers[0].VolumeMounts[0].MountPath + "/test"
|
||||||
var checkSumClone string
|
var checkSumClone string
|
||||||
@ -863,9 +887,6 @@ func validatePVCSnapshot(
|
|||||||
checkSumClone)
|
checkSumClone)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if wgErrs[n] == nil && kms != noKMS {
|
|
||||||
wgErrs[n] = isEncryptedPVC(f, &p, &a)
|
|
||||||
}
|
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}(i, *pvcClone, *appClone)
|
}(i, *pvcClone, *appClone)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user