1
0
mirror of https://github.com/ceph/go-ceph synced 2025-01-14 01:52:15 +00:00

cephfs: update TestCreateMountWithId to check custom id is used

Now that we have mds command function, we can use it to check for the id
we passed to CreateMountWithId appears in the session list.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-01-28 13:12:33 -05:00 committed by Niels de Vos
parent 34f1507992
commit 2240c56614

View File

@ -224,10 +224,7 @@ func TestCreateFromRados(t *testing.T) {
}
func TestCreateMountWithId(t *testing.T) {
// TODO: the entity_id is visible w/in the 'session ls' output
// of mds. Consider running the equivalent api call and checking
// that the string is set.
mount, err := CreateMountWithId("bob")
mount, err := CreateMountWithId("bobolink")
assert.NoError(t, err)
assert.NotNil(t, mount)
@ -236,6 +233,17 @@ func TestCreateMountWithId(t *testing.T) {
err = mount.Mount()
assert.NoError(t, err)
// verify the custom entity_id is visible in the 'session ls' output
// of mds.
cmd := []byte(`{"prefix": "session ls"}`)
buf, info, err := mount.MdsCommand(
"Z", // TODO: fix hard-coded name mds (from ci container script)
[][]byte{cmd})
assert.NoError(t, err)
assert.NotEqual(t, "", string(buf))
assert.Equal(t, "", string(info))
assert.Contains(t, string(buf), `"bobolink"`)
}
func TestMdsCommand(t *testing.T) {