mirror of https://github.com/ceph/go-ceph
cephfs: allow passing mds name into test through env var
Previously, the mds name was hardcoded in the tests to match that set up by "micro-osd.sh". We continue to default to that value, but allow the test to be supplied a custom value by the environment. Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
900302b1ce
commit
ab178bc7ed
|
@ -18,6 +18,7 @@ import (
|
|||
var (
|
||||
CephMountDir = "/tmp/ceph/mds/mnt/"
|
||||
requireCephMount = false
|
||||
testMdsName = "Z"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -29,6 +30,10 @@ func init() {
|
|||
if reqMount == "yes" || reqMount == "true" {
|
||||
requireCephMount = true
|
||||
}
|
||||
mdsName := os.Getenv("GO_CEPH_TEST_MDS_NAME")
|
||||
if mdsName != "" {
|
||||
testMdsName = mdsName
|
||||
}
|
||||
}
|
||||
|
||||
func useMount(t *testing.T) {
|
||||
|
@ -287,7 +292,7 @@ func TestCreateMountWithId(t *testing.T) {
|
|||
// of mds.
|
||||
cmd := []byte(`{"prefix": "session ls"}`)
|
||||
buf, info, err := mount.MdsCommand(
|
||||
"Z", // TODO: fix hard-coded name mds (from ci container script)
|
||||
testMdsName,
|
||||
[][]byte{cmd})
|
||||
assert.NoError(t, err)
|
||||
assert.NotEqual(t, "", string(buf))
|
||||
|
@ -300,7 +305,7 @@ func TestMdsCommand(t *testing.T) {
|
|||
|
||||
cmd := []byte(`{"prefix": "client ls"}`)
|
||||
buf, info, err := mount.MdsCommand(
|
||||
"Z", // TODO: fix hard-coded name mds (from ci container script)
|
||||
testMdsName,
|
||||
[][]byte{cmd})
|
||||
assert.NoError(t, err)
|
||||
assert.NotEqual(t, "", string(buf))
|
||||
|
@ -318,7 +323,7 @@ func TestMdsCommandError(t *testing.T) {
|
|||
|
||||
cmd := []byte("iAMinValId~~~")
|
||||
buf, info, err := mount.MdsCommand(
|
||||
"Z", // TODO: fix hard-coded name mds (from ci container script)
|
||||
testMdsName,
|
||||
[][]byte{cmd})
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, "", string(buf))
|
||||
|
|
Loading…
Reference in New Issue