From 8d038db047bd3542a6932f81148bda9158c1e784 Mon Sep 17 00:00:00 2001 From: Yug Date: Mon, 22 Mar 2021 13:05:15 +0530 Subject: [PATCH] e2e: add e2e to test clone in different pool added a e2e to test clones in different pool. Co-authored-by: Madhu Rajanna Signed-off-by: Yug --- e2e/rbd.go | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/e2e/rbd.go b/e2e/rbd.go index 18cb52e0f..07cc0601f 100644 --- a/e2e/rbd.go +++ b/e2e/rbd.go @@ -1212,6 +1212,52 @@ var _ = Describe("RBD", func() { } }) + By("create rbd clones in different pool", func() { + // snapshot beta is only supported from v1.17+ + if !k8sVersionGreaterEquals(f.ClientSet, 1, 17) { + Skip("pvc restore is only supported from v1.17+") + } + clonePool := "clone-test" + // create pool for clones + err := createPool(f, clonePool) + if err != nil { + e2elog.Failf("failed to create pool %s with error %v", clonePool, err) + } + err = createRBDSnapshotClass(f) + if err != nil { + e2elog.Failf("failed to create snapshotclass with error %v", err) + } + cloneSC := "clone-storageclass" + param := map[string]string{ + "pool": clonePool, + } + // create new storageclass with new pool + err = createRBDStorageClass(f.ClientSet, f, cloneSC, nil, param, deletePolicy) + if err != nil { + e2elog.Failf("failed to create storageclass with error %v", err) + } + err = validateCloneInDifferentPool(f, defaultRBDPool, cloneSC, clonePool) + if err != nil { + e2elog.Failf("failed to validate clones in different pool with error %v", err) + } + + _, err = framework.RunKubectl(cephCSINamespace, "delete", "sc", cloneSC, "--ignore-not-found=true") + if err != nil { + e2elog.Failf("failed to delete storageclass %s with error %v", cloneSC, err) + } + + err = deleteResource(rbdExamplePath + "snapshotclass.yaml") + if err != nil { + e2elog.Failf("failed to delete snapshotclass with error %v", err) + } + + err = deletePool(clonePool, false, f) + if err != nil { + e2elog.Failf("failed to delete pool %s with error %v", clonePool, err) + } + + }) + By("create ROX PVC clone and mount it to multiple pods", func() { // snapshot beta is only supported from v1.17+ if k8sVersionGreaterEquals(f.ClientSet, 1, 17) {