From d943fbd265adba5c2626f45864137ea90a5f75fa Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Wed, 1 Dec 2021 13:06:53 +0530 Subject: [PATCH] e2e: run generic ephemeral for kubernetes 1.21+ Currently, we are skipping the generic ephemeral testing if the kubernetes version is less than 1.21 because of this one the who test suite is getting skipped and e2e is marked as success in 2 minutes. This commit runs the ephemeral tests if the kube=>1.21+. If we do this, for the lower version we can run other tests. Signed-off-by: Madhu Rajanna --- e2e/cephfs.go | 53 +++++++++++++++++++++++++-------------------------- e2e/rbd.go | 49 +++++++++++++++++++++++------------------------ 2 files changed, 50 insertions(+), 52 deletions(-) diff --git a/e2e/cephfs.go b/e2e/cephfs.go index b340969da..452b480e4 100644 --- a/e2e/cephfs.go +++ b/e2e/cephfs.go @@ -315,33 +315,32 @@ var _ = Describe("cephfs", func() { } By("verify generic ephemeral volume support", func() { // generic ephemeral volume support is beta since v1.21. - if !k8sVersionGreaterEquals(f.ClientSet, 1, 21) { - Skip("generic ephemeral volume only supported from v1.21+") - } - err := createCephfsStorageClass(f.ClientSet, f, true, nil) - if err != nil { - e2elog.Failf("failed to create CephFS storageclass: %v", err) - } - // create application - app, err := loadApp(appEphemeralPath) - if err != nil { - e2elog.Failf("failed to load application: %v", err) - } - app.Namespace = f.UniqueName - err = createApp(f.ClientSet, app, deployTimeout) - if err != nil { - e2elog.Failf("failed to create application: %v", err) - } - validateSubvolumeCount(f, 1, fileSystemName, subvolumegroup) - // delete pod - err = deletePod(app.Name, app.Namespace, f.ClientSet, deployTimeout) - if err != nil { - e2elog.Failf("failed to delete application: %v", err) - } - validateSubvolumeCount(f, 0, fileSystemName, subvolumegroup) - err = deleteResource(cephFSExamplePath + "storageclass.yaml") - if err != nil { - e2elog.Failf("failed to delete CephFS storageclass: %v", err) + if k8sVersionGreaterEquals(f.ClientSet, 1, 21) { + err := createCephfsStorageClass(f.ClientSet, f, true, nil) + if err != nil { + e2elog.Failf("failed to create CephFS storageclass: %v", err) + } + // create application + app, err := loadApp(appEphemeralPath) + if err != nil { + e2elog.Failf("failed to load application: %v", err) + } + app.Namespace = f.UniqueName + err = createApp(f.ClientSet, app, deployTimeout) + if err != nil { + e2elog.Failf("failed to create application: %v", err) + } + validateSubvolumeCount(f, 1, fileSystemName, subvolumegroup) + // delete pod + err = deletePod(app.Name, app.Namespace, f.ClientSet, deployTimeout) + if err != nil { + e2elog.Failf("failed to delete application: %v", err) + } + validateSubvolumeCount(f, 0, fileSystemName, subvolumegroup) + err = deleteResource(cephFSExamplePath + "storageclass.yaml") + if err != nil { + e2elog.Failf("failed to delete CephFS storageclass: %v", err) + } } }) diff --git a/e2e/rbd.go b/e2e/rbd.go index a7cc6d4f5..27f1931ea 100644 --- a/e2e/rbd.go +++ b/e2e/rbd.go @@ -373,31 +373,30 @@ var _ = Describe("RBD", func() { } By("verify generic ephemeral volume support", func() { // generic ephemeral volume support is supported from 1.21 - if !k8sVersionGreaterEquals(f.ClientSet, 1, 21) { - Skip("generic ephemeral volume only supported from v1.21+") - } - // create application - app, err := loadApp(appEphemeralPath) - if err != nil { - e2elog.Failf("failed to load application: %v", err) - } - app.Namespace = f.UniqueName - err = createApp(f.ClientSet, app, deployTimeout) - if err != nil { - e2elog.Failf("failed to create application: %v", err) - } - // validate created backend rbd images - validateRBDImageCount(f, 1, defaultRBDPool) - err = deletePod(app.Name, app.Namespace, f.ClientSet, deployTimeout) - if err != nil { - e2elog.Failf("failed to delete application: %v", err) - } - // validate created backend rbd images - validateRBDImageCount(f, 0, defaultRBDPool) - // validate images in trash - err = waitToRemoveImagesFromTrash(f, defaultRBDPool, deployTimeout) - if err != nil { - e2elog.Failf("failed to validate rbd images in pool %s trash: %v", defaultRBDPool, err) + if k8sVersionGreaterEquals(f.ClientSet, 1, 21) { + // create application + app, err := loadApp(appEphemeralPath) + if err != nil { + e2elog.Failf("failed to load application: %v", err) + } + app.Namespace = f.UniqueName + err = createApp(f.ClientSet, app, deployTimeout) + if err != nil { + e2elog.Failf("failed to create application: %v", err) + } + // validate created backend rbd images + validateRBDImageCount(f, 1, defaultRBDPool) + err = deletePod(app.Name, app.Namespace, f.ClientSet, deployTimeout) + if err != nil { + e2elog.Failf("failed to delete application: %v", err) + } + // validate created backend rbd images + validateRBDImageCount(f, 0, defaultRBDPool) + // validate images in trash + err = waitToRemoveImagesFromTrash(f, defaultRBDPool, deployTimeout) + if err != nil { + e2elog.Failf("failed to validate rbd images in pool %s trash: %v", defaultRBDPool, err) + } } })