mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
e2e: add various testcases to validate unset of metadata
Validate that we: * Unset the PVC metadata on the rbd image created for the snapshot * snapshot metadata on CreateVolume from snapshot Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
27f503c144
commit
89a7ada12f
@ -229,6 +229,7 @@ func getVolumeSnapshotContent(namespace, snapshotName string) (*snapapi.VolumeSn
|
||||
return volumeSnapshotContent, nil
|
||||
}
|
||||
|
||||
// nolint:gocyclo,cyclop // reduce complexity
|
||||
func validateBiggerPVCFromSnapshot(f *framework.Framework,
|
||||
pvcPath,
|
||||
appPath,
|
||||
@ -305,6 +306,43 @@ func validateBiggerPVCFromSnapshot(f *framework.Framework,
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to validate device size: %w", err)
|
||||
}
|
||||
|
||||
// make sure we had unset snapshot metadata on CreateVolume
|
||||
// from snapshot
|
||||
var (
|
||||
volSnapName string
|
||||
volSnapNamespace string
|
||||
volSnapContentName string
|
||||
stdErr string
|
||||
imageList []string
|
||||
)
|
||||
imageList, err = listRBDImages(f, defaultRBDPool)
|
||||
if err != nil {
|
||||
e2elog.Failf("failed to list rbd images: %v", err)
|
||||
}
|
||||
e2elog.Logf("list of rbd images: %v", imageList)
|
||||
volSnapName, stdErr, err = execCommandInToolBoxPod(f,
|
||||
formatImageMetaGetCmd(defaultRBDPool, imageList[0], volSnapNameKey),
|
||||
rookNamespace)
|
||||
if checkGetKeyError(err, stdErr) {
|
||||
e2elog.Failf("found volume snapshot name %s/%s %s=%s: err=%v stdErr=%q",
|
||||
rbdOptions(defaultRBDPool), imageList[0], volSnapNameKey, volSnapName, err, stdErr)
|
||||
}
|
||||
volSnapNamespace, stdErr, err = execCommandInToolBoxPod(f,
|
||||
formatImageMetaGetCmd(defaultRBDPool, imageList[0], volSnapNamespaceKey),
|
||||
rookNamespace)
|
||||
if checkGetKeyError(err, stdErr) {
|
||||
e2elog.Failf("found volume snapshot namespace %s/%s %s=%s: err=%v stdErr=%q",
|
||||
rbdOptions(defaultRBDPool), imageList[0], volSnapNamespaceKey, volSnapNamespace, err, stdErr)
|
||||
}
|
||||
volSnapContentName, stdErr, err = execCommandInToolBoxPod(f,
|
||||
formatImageMetaGetCmd(defaultRBDPool, imageList[0], volSnapContentNameKey),
|
||||
rookNamespace)
|
||||
if checkGetKeyError(err, stdErr) {
|
||||
e2elog.Failf("found snapshotcontent name %s/%s %s=%s: err=%v stdErr=%q",
|
||||
rbdOptions(defaultRBDPool), imageList[0], volSnapContentNameKey,
|
||||
volSnapContentName, err, stdErr)
|
||||
}
|
||||
}
|
||||
err = deletePVCAndApp("", f, pvcClone, appClone)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user