cephfs admin: update test helper functions to work on ceph "pacific"

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2021-03-17 14:42:49 -04:00 committed by Sven Anderson
parent 52ef909e2b
commit 1f02b52df2
2 changed files with 15 additions and 12 deletions

View File

@ -22,8 +22,13 @@ var (
debugTrace = false debugTrace = false
// some tests are sensitive to the server version // some tests are sensitive to the server version
serverIsNautilus = false serverVersion string
serverIsOctopus = false )
const (
cephNautilus = "nautilus"
cephOctopus = "octopus"
cephPacfic = "pacific"
) )
func init() { func init() {
@ -31,11 +36,9 @@ func init() {
if ok, err := strconv.ParseBool(dt); ok && err == nil { if ok, err := strconv.ParseBool(dt); ok && err == nil {
debugTrace = true debugTrace = true
} }
switch os.Getenv("CEPH_VERSION") { switch vname := os.Getenv("CEPH_VERSION"); vname {
case "nautilus": case cephNautilus, cephOctopus, cephPacfic:
serverIsNautilus = true serverVersion = vname
case "octopus":
serverIsOctopus = true
} }
} }
@ -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 // 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 // server version it expects and force us to update the tests if a new
// version of ceph is added. // version of ceph is added.
if !serverIsNautilus && !serverIsOctopus { if serverVersion == "" {
t.Fatalf("server must be nautilus or octopus (do the tests need updating?)") t.Fatalf("server must be nautilus, octopus, or pacific (do the tests need updating?)")
} }
} }

View File

@ -178,8 +178,8 @@ func TestParseDumpToIdents(t *testing.T) {
} }
func TestVolumeStatus(t *testing.T) { func TestVolumeStatus(t *testing.T) {
if !serverIsOctopus { if serverVersion == cephNautilus {
t.Skipf("can only execute on octopus servers") t.Skipf("can only execute on octopus/pacific servers")
} }
fsa := getFSAdmin(t) fsa := getFSAdmin(t)
@ -189,7 +189,7 @@ func TestVolumeStatus(t *testing.T) {
} }
func TestVolumeStatusInvalid(t *testing.T) { func TestVolumeStatusInvalid(t *testing.T) {
if !serverIsNautilus { if serverVersion != cephNautilus {
t.Skipf("can only excecute on nautilus servers") t.Skipf("can only excecute on nautilus servers")
} }
fsa := getFSAdmin(t) fsa := getFSAdmin(t)