Skip to content

Commit 18fcad1

Browse files
anoopcs9mergify[bot]
authored andcommitted
cephfs/admin: Use internal wrapper for detecting server version
Signed-off-by: Anoop C S <[email protected]>
1 parent 3e10208 commit 18fcad1

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

cephfs/admin/fsadmin_test.go

+2-15
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ package admin
22

33
import (
44
"errors"
5-
"os"
65
"testing"
76

87
"github.com/stretchr/testify/assert"
98

109
"github.com/ceph/go-ceph/internal/admintest"
10+
"github.com/ceph/go-ceph/internal/util"
1111
)
1212

1313
var (
@@ -17,21 +17,8 @@ var (
1717
serverVersion string
1818
)
1919

20-
const (
21-
cephNautilus = "nautilus"
22-
cephOctopus = "octopus"
23-
cephPacfic = "pacific"
24-
cephQuincy = "quincy"
25-
cephReef = "reef"
26-
cephSquid = "squid"
27-
cephMain = "main"
28-
)
29-
3020
func init() {
31-
switch vname := os.Getenv("CEPH_VERSION"); vname {
32-
case cephNautilus, cephOctopus, cephPacfic, cephQuincy, cephReef, cephSquid, cephMain:
33-
serverVersion = vname
34-
}
21+
serverVersion = util.CurrentCephVersionString()
3522
}
3623

3724
func TestServerSentinel(t *testing.T) {

cephfs/admin/volume_test.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"testing"
66

77
"github.com/stretchr/testify/assert"
8+
9+
"github.com/ceph/go-ceph/internal/util"
810
)
911

1012
func TestListVolumes(t *testing.T) {
@@ -182,7 +184,7 @@ func TestParseDumpToIdents(t *testing.T) {
182184
}
183185

184186
func TestVolumeStatus(t *testing.T) {
185-
if serverVersion == cephNautilus {
187+
if serverVersion == util.Nautilus {
186188
t.Skipf("can only execute on octopus/pacific servers")
187189
}
188190
fsa := getFSAdmin(t)
@@ -193,7 +195,7 @@ func TestVolumeStatus(t *testing.T) {
193195
}
194196

195197
func TestVolumeStatusInvalid(t *testing.T) {
196-
if serverVersion != cephNautilus {
198+
if serverVersion != util.Nautilus {
197199
t.Skipf("can only excecute on nautilus servers")
198200
}
199201
fsa := getFSAdmin(t)

0 commit comments

Comments
 (0)