mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 22:30:23 +00:00
e2e: modify validatePVCSnapshot() to use restoreSCName & restoreKMS
Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
parent
59b7a26175
commit
f63ed2ca5a
@ -1102,7 +1102,8 @@ var _ = Describe("RBD", func() {
|
|||||||
snapshotPath,
|
snapshotPath,
|
||||||
pvcClonePath,
|
pvcClonePath,
|
||||||
appClonePath,
|
appClonePath,
|
||||||
noKMS,
|
noKMS, noKMS,
|
||||||
|
defaultSCName,
|
||||||
f)
|
f)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1169,7 +1170,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
@ -758,7 +758,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)
|
||||||
@ -859,6 +860,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)
|
||||||
@ -872,6 +876,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
|
||||||
@ -888,9 +912,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