From ab178bc7edf7501013a23db3e41cc22d3be0a824 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Mon, 23 Mar 2020 14:41:05 -0400 Subject: [PATCH] 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 --- cephfs/cephfs_test.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cephfs/cephfs_test.go b/cephfs/cephfs_test.go index 40c0490..2761745 100644 --- a/cephfs/cephfs_test.go +++ b/cephfs/cephfs_test.go @@ -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))