From 4ebfeaaa75d425f465e67978b89ac751b0eee4b4 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 7 Dec 2021 13:35:31 +0530 Subject: [PATCH] e2e: add e2e testcase of new image features adding e2e testcase to validate the workflow of pvc creation and attaching to pod works for new image features like fast-diff,obj-map,exclusive-lock and layering. fixes: #2695 Signed-off-by: Madhu Rajanna --- e2e/rbd.go | 74 +++++++++++++++++++++++++++++++++++++++++++++++ e2e/rbd_helper.go | 12 ++++++++ 2 files changed, 86 insertions(+) diff --git a/e2e/rbd.go b/e2e/rbd.go index 31e68f95b..42fd288f6 100644 --- a/e2e/rbd.go +++ b/e2e/rbd.go @@ -649,6 +649,80 @@ var _ = Describe("RBD", func() { } }) + By("create PVC with layering,fast-diff image-features and bind it to an app", + func() { + if util.CheckKernelSupport(kernelRelease, fastDiffSupport) { + err := deleteResource(rbdExamplePath + "storageclass.yaml") + if err != nil { + e2elog.Failf("failed to delete storageclass: %v", err) + } + err = createRBDStorageClass( + f.ClientSet, + f, + defaultSCName, + nil, + map[string]string{ + "imageFeatures": "layering,exclusive-lock,object-map,fast-diff", + }, + deletePolicy) + if err != nil { + e2elog.Failf("failed to create storageclass: %v", err) + } + err = validatePVCAndAppBinding(pvcPath, appPath, f) + if err != nil { + e2elog.Failf("failed to validate CephFS pvc and application binding: %v", err) + } + // validate created backend rbd images + validateRBDImageCount(f, 0, defaultRBDPool) + err = deleteResource(rbdExamplePath + "storageclass.yaml") + if err != nil { + e2elog.Failf("failed to delete storageclass: %v", err) + } + err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, nil, deletePolicy) + if err != nil { + e2elog.Failf("failed to create storageclass: %v", err) + } + } + }) + + By("create PVC with journaling,fast-diff image-features and bind it to an app using rbd-nbd mounter", + func() { + if util.CheckKernelSupport(kernelRelease, fastDiffSupport) { + err := deleteResource(rbdExamplePath + "storageclass.yaml") + if err != nil { + e2elog.Failf("failed to delete storageclass: %v", err) + } + // Storage class with rbd-nbd mounter + err = createRBDStorageClass( + f.ClientSet, + f, + defaultSCName, + nil, + map[string]string{ + "mounter": "rbd-nbd", + "imageFeatures": "layering,journaling,exclusive-lock,object-map,fast-diff", + }, + deletePolicy) + if err != nil { + e2elog.Failf("failed to create storageclass: %v", err) + } + err = validatePVCAndAppBinding(pvcPath, appPath, f) + if err != nil { + e2elog.Failf("failed to validate CephFS pvc and application binding: %v", err) + } + // validate created backend rbd images + validateRBDImageCount(f, 0, defaultRBDPool) + err = deleteResource(rbdExamplePath + "storageclass.yaml") + if err != nil { + e2elog.Failf("failed to delete storageclass: %v", err) + } + err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, nil, deletePolicy) + if err != nil { + e2elog.Failf("failed to create storageclass: %v", err) + } + } + }) + // NOTE: RWX is restricted for FileSystem VolumeMode at ceph-csi, // see pull#261 for more details. By("Create RWX+Block Mode PVC and bind to multiple pods via deployment using rbd-nbd mounter", func() { diff --git a/e2e/rbd_helper.go b/e2e/rbd_helper.go index 6d6950fb4..8ebcfc4b1 100644 --- a/e2e/rbd_helper.go +++ b/e2e/rbd_helper.go @@ -40,6 +40,18 @@ var nbdResizeSupport = []util.KernelVersion{ }, // standard 5.3+ versions } +// nolint:gomnd // numbers specify Kernel versions. +var fastDiffSupport = []util.KernelVersion{ + { + Version: 5, + PatchLevel: 3, + SubLevel: 0, + ExtraVersion: 0, + Distribution: "", + Backport: false, + }, // standard 5.3+ versions +} + // To use `io-timeout=0` we need // www.mail-archive.com/linux-block@vger.kernel.org/msg38060.html // nolint:gomnd // numbers specify Kernel versions.