mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
e2e: add test cases for pvc-pvcClone chain with depth 2
Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
parent
9321b4bce4
commit
9d57717222
100
e2e/rbd.go
100
e2e/rbd.go
@ -1942,6 +1942,106 @@ var _ = Describe("RBD", func() {
|
|||||||
validateRBDImageCount(f, 0, defaultRBDPool)
|
validateRBDImageCount(f, 0, defaultRBDPool)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
By("validate PVC Clone chained with depth 2", func() {
|
||||||
|
// snapshot beta is only supported from v1.17+
|
||||||
|
if !k8sVersionGreaterEquals(f.ClientSet, 1, 17) {
|
||||||
|
Skip("pvc restore is only supported from v1.17+")
|
||||||
|
}
|
||||||
|
cloneChainDepth := 2
|
||||||
|
|
||||||
|
err := deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to delete storageclass with error %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = createRBDStorageClass(
|
||||||
|
f.ClientSet,
|
||||||
|
f,
|
||||||
|
defaultSCName,
|
||||||
|
nil,
|
||||||
|
map[string]string{
|
||||||
|
"encrypted": "true",
|
||||||
|
"encryptionKMSID": "vault-test",
|
||||||
|
},
|
||||||
|
deletePolicy)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to create storageclass with error %v", err)
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
err = deleteResource(rbdExamplePath + "storageclass.yaml")
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to delete storageclass with error %v", err)
|
||||||
|
}
|
||||||
|
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, nil, deletePolicy)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to create storageclass with error %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
// create PVC and bind it to an app
|
||||||
|
pvc, err := loadPVC(pvcPath)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to load PVC with error %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
pvc.Namespace = f.UniqueName
|
||||||
|
app, err := loadApp(appPath)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to load application with error %v", err)
|
||||||
|
}
|
||||||
|
app.Namespace = f.UniqueName
|
||||||
|
err = createPVCAndApp("", f, pvc, app, deployTimeout)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to create PVC and application with error %v", err)
|
||||||
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
validateRBDImageCount(f, 1, defaultRBDPool)
|
||||||
|
|
||||||
|
for i := 0; i < cloneChainDepth; i++ {
|
||||||
|
var pvcClone *v1.PersistentVolumeClaim
|
||||||
|
pvcClone, err = loadPVC(pvcSmartClonePath)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to load PVC with error %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// create clone PVC
|
||||||
|
pvcClone.Name = fmt.Sprintf("%s-%d", pvcClone.Name, i)
|
||||||
|
pvcClone.Namespace = f.UniqueName
|
||||||
|
pvcClone.Spec.DataSource.Name = pvc.Name
|
||||||
|
err = createPVCAndvalidatePV(f.ClientSet, pvcClone, deployTimeout)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to create PVC with error %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete parent PVC
|
||||||
|
err = deletePVCAndApp("", f, pvc, app)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to delete PVC and application with error %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
app.Spec.Volumes[0].PersistentVolumeClaim.ClaimName = pvcClone.Name
|
||||||
|
// create application
|
||||||
|
err = createApp(f.ClientSet, app, deployTimeout)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to create application with error %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
pvc = pvcClone
|
||||||
|
}
|
||||||
|
|
||||||
|
err = deletePod(app.Name, app.Namespace, f.ClientSet, deployTimeout)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to delete application with error %v", err)
|
||||||
|
}
|
||||||
|
// delete PVC clone
|
||||||
|
err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout)
|
||||||
|
if err != nil {
|
||||||
|
e2elog.Failf("failed to delete PVC with error %v", err)
|
||||||
|
}
|
||||||
|
// validate created backend rbd images
|
||||||
|
validateRBDImageCount(f, 0, defaultRBDPool)
|
||||||
|
})
|
||||||
|
|
||||||
By("ensuring all operations will work within a rados namespace", func() {
|
By("ensuring all operations will work within a rados namespace", func() {
|
||||||
updateConfigMap := func(radosNS string) {
|
updateConfigMap := func(radosNS string) {
|
||||||
radosNamespace = radosNS
|
radosNamespace = radosNS
|
||||||
|
Loading…
Reference in New Issue
Block a user