From 1f02b52df2a1087253c7d30e44a8e393e0deca6a Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 17 Mar 2021 14:42:49 -0400 Subject: [PATCH] cephfs admin: update test helper functions to work on ceph "pacific" Signed-off-by: John Mulligan --- cephfs/admin/fsadmin_test.go | 21 ++++++++++++--------- cephfs/admin/volume_test.go | 6 +++--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/cephfs/admin/fsadmin_test.go b/cephfs/admin/fsadmin_test.go index 517398a..ef0f466 100644 --- a/cephfs/admin/fsadmin_test.go +++ b/cephfs/admin/fsadmin_test.go @@ -22,8 +22,13 @@ var ( debugTrace = false // some tests are sensitive to the server version - serverIsNautilus = false - serverIsOctopus = false + serverVersion string +) + +const ( + cephNautilus = "nautilus" + cephOctopus = "octopus" + cephPacfic = "pacific" ) func init() { @@ -31,11 +36,9 @@ func init() { if ok, err := strconv.ParseBool(dt); ok && err == nil { debugTrace = true } - switch os.Getenv("CEPH_VERSION") { - case "nautilus": - serverIsNautilus = true - case "octopus": - serverIsOctopus = true + switch vname := os.Getenv("CEPH_VERSION"); vname { + case cephNautilus, cephOctopus, cephPacfic: + serverVersion = vname } } @@ -49,8 +52,8 @@ func TestServerSentinel(t *testing.T) { // This check is intended to fail the test suite if you don't tell it a // server version it expects and force us to update the tests if a new // version of ceph is added. - if !serverIsNautilus && !serverIsOctopus { - t.Fatalf("server must be nautilus or octopus (do the tests need updating?)") + if serverVersion == "" { + t.Fatalf("server must be nautilus, octopus, or pacific (do the tests need updating?)") } } diff --git a/cephfs/admin/volume_test.go b/cephfs/admin/volume_test.go index 2c6dc30..da521a3 100644 --- a/cephfs/admin/volume_test.go +++ b/cephfs/admin/volume_test.go @@ -178,8 +178,8 @@ func TestParseDumpToIdents(t *testing.T) { } func TestVolumeStatus(t *testing.T) { - if !serverIsOctopus { - t.Skipf("can only execute on octopus servers") + if serverVersion == cephNautilus { + t.Skipf("can only execute on octopus/pacific servers") } fsa := getFSAdmin(t) @@ -189,7 +189,7 @@ func TestVolumeStatus(t *testing.T) { } func TestVolumeStatusInvalid(t *testing.T) { - if !serverIsNautilus { + if serverVersion != cephNautilus { t.Skipf("can only excecute on nautilus servers") } fsa := getFSAdmin(t)