e2e: Enable E2E for rbd snapshot

Updated E2E to use beta client and beta
Snapshot resources.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2020-04-16 12:39:59 +05:30
committed by mergify[bot]
parent 13438e8369
commit c5bf95b625
3 changed files with 203 additions and 182 deletions

View File

@ -180,9 +180,9 @@ var _ = Describe("RBD", func() {
appPath := rbdExamplePath + "pod.yaml"
rawPvcPath := rbdExamplePath + "raw-block-pvc.yaml"
rawAppPath := rbdExamplePath + "raw-block-pod.yaml"
// pvcClonePath := rbdExamplePath + "pvc-restore.yaml"
// appClonePath := rbdExamplePath + "pod-restore.yaml"
// snapshotPath := rbdExamplePath + "snapshot.yaml"
pvcClonePath := rbdExamplePath + "pvc-restore.yaml"
appClonePath := rbdExamplePath + "pod-restore.yaml"
snapshotPath := rbdExamplePath + "snapshot.yaml"
By("checking provisioner deployment is running", func() {
err := waitForDeploymentComplete(rbdDeploymentName, cephCSINamespace, f.ClientSet, deployTimeout)
@ -235,55 +235,53 @@ var _ = Describe("RBD", func() {
})
// skipping snapshot testing
By("create a PVC clone and Bind it to an app", func() {
createRBDSnapshotClass(f)
pvc, err := loadPVC(pvcPath)
if err != nil {
Fail(err.Error())
}
// By("create a PVC clone and Bind it to an app", func() {
// createRBDSnapshotClass(f)
// pvc, err := loadPVC(pvcPath)
// if err != nil {
// Fail(err.Error())
// }
pvc.Namespace = f.UniqueName
e2elog.Logf("The PVC template %+v", pvc)
err = createPVCAndvalidatePV(f.ClientSet, pvc, deployTimeout)
if err != nil {
Fail(err.Error())
}
// validate created backend rbd images
images := listRBDImages(f)
if len(images) != 1 {
e2elog.Logf("backend image count %d expected image count %d", len(images), 1)
Fail("validate backend image failed")
}
snap := getSnapshot(snapshotPath)
snap.Namespace = f.UniqueName
snap.Spec.Source.PersistentVolumeClaimName = &pvc.Name
err = createSnapshot(&snap, deployTimeout)
if err != nil {
Fail(err.Error())
}
pool := "replicapool"
snapList, err := listSnapshots(f, pool, images[0])
if err != nil {
Fail(err.Error())
}
if len(snapList) != 1 {
e2elog.Logf("backend snapshot not matching kube snap count,snap count = % kube snap count %d", len(snapList), 1)
Fail("validate backend snapshot failed")
}
// pvc.Namespace = f.UniqueName
// e2elog.Logf("The PVC template %+v", pvc)
// err = createPVCAndvalidatePV(f.ClientSet, pvc, deployTimeout)
// if err != nil {
// Fail(err.Error())
// }
// // validate created backend rbd images
// images := listRBDImages(f)
// if len(images) != 1 {
// e2elog.Logf("backend image count %d expected image count %d", len(images), 1)
// Fail("validate backend image failed")
// }
// snap := getSnapshot(snapshotPath)
// snap.Namespace = f.UniqueName
// snap.Spec.Source.Name = pvc.Name
// snap.Spec.Source.Kind = "PersistentVolumeClaim"
// err = createSnapshot(&snap, deployTimeout)
// if err != nil {
// Fail(err.Error())
// }
// pool := "replicapool"
// snapList, err := listSnapshots(f, pool, images[0])
// if err != nil {
// Fail(err.Error())
// }
// if len(snapList) != 1 {
// e2elog.Logf("backend snapshot not matching kube snap count,snap count = % kube snap count %d", len(snapList), 1)
// Fail("validate backend snapshot failed")
// }
validatePVCAndAppBinding(pvcClonePath, appClonePath, f)
// validatePVCAndAppBinding(pvcClonePath, appClonePath, f)
// err = deleteSnapshot(&snap, deployTimeout)
// if err != nil {
// Fail(err.Error())
// }
// err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout)
// if err != nil {
// Fail(err.Error())
// }
// })
err = deleteSnapshot(&snap, deployTimeout)
if err != nil {
Fail(err.Error())
}
err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout)
if err != nil {
Fail(err.Error())
}
})
By("create a block type PVC and Bind it to an app", func() {
validatePVCAndAppBinding(rawPvcPath, rawAppPath, f)