From e008e1609551a58460cb9857e8c6f97bb60fec09 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Fri, 12 Jan 2024 09:08:16 +0100 Subject: [PATCH] e2e: add e2e to test static pvc added e2e test case to verify static pvc with and without fsName in the PV object. Signed-off-by: Madhu Rajanna --- e2e/cephfs.go | 14 +++++++++++--- e2e/staticpvc.go | 6 ++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/e2e/cephfs.go b/e2e/cephfs.go index 43171537f..6a1de944d 100644 --- a/e2e/cephfs.go +++ b/e2e/cephfs.go @@ -474,11 +474,19 @@ var _ = Describe(cephfsType, func() { } }) - By("check static PVC", func() { + By("check static PVC with FsName", func() { scPath := cephFSExamplePath + "secret.yaml" - err := validateCephFsStaticPV(f, appPath, scPath) + err := validateCephFsStaticPV(f, appPath, scPath, fileSystemName) if err != nil { - framework.Failf("failed to validate CephFS static pv: %v", err) + framework.Failf("failed to validate CephFS static pv with filesystem name: %v", err) + } + }) + + By("check static PVC with without FsName", func() { + scPath := cephFSExamplePath + "secret.yaml" + err := validateCephFsStaticPV(f, appPath, scPath, "") + if err != nil { + framework.Failf("failed to validate CephFS static pv without filesystem name: %v", err) } }) diff --git a/e2e/staticpvc.go b/e2e/staticpvc.go index f76d76f6a..bed9bd3ab 100644 --- a/e2e/staticpvc.go +++ b/e2e/staticpvc.go @@ -323,7 +323,7 @@ func validateRBDStaticMigrationPVC(f *framework.Framework, appPath, scName strin } //nolint:gocyclo,cyclop // reduce complexity -func validateCephFsStaticPV(f *framework.Framework, appPath, scPath string) error { +func validateCephFsStaticPV(f *framework.Framework, appPath, scPath, fsName string) error { opt := make(map[string]string) var ( cephFsVolName = "testSubVol" @@ -406,7 +406,9 @@ func validateCephFsStaticPV(f *framework.Framework, appPath, scPath string) erro } opt["clusterID"] = fsID - opt["fsName"] = fileSystemName + if fsName != "" { + opt["fsName"] = fsName + } opt["staticVolume"] = strconv.FormatBool(true) opt["rootPath"] = rootPath pv := getStaticPV(