From 36196c5e60de6f9e25d8353c44a2f9fb59c6d1f3 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Mon, 23 Mar 2020 16:58:15 -0400 Subject: [PATCH] cephfs: release fs resources in remaining test cases In a previous commit we added fsDisconnect to match with fsConnect. For tests that do not use fsConnect but still acquire resources we need to free up those resources with direct calls to the appropriate functions. Signed-off-by: John Mulligan --- cephfs/cephfs_test.go | 5 +++++ cephfs/conn_nautilus_test.go | 1 + 2 files changed, 6 insertions(+) diff --git a/cephfs/cephfs_test.go b/cephfs/cephfs_test.go index 63b1e18..ccf7852 100644 --- a/cephfs/cephfs_test.go +++ b/cephfs/cephfs_test.go @@ -164,9 +164,11 @@ func TestUnmountMount(t *testing.T) { require.NoError(t, err) require.NotNil(t, mount) assert.False(t, mount.IsMounted()) + assert.NoError(t, mount.Release()) }) t.Run("mountUnmount", func(t *testing.T) { mount := fsConnect(t) + defer func() { assert.NoError(t, mount.Release()) }() assert.True(t, mount.IsMounted()) err := mount.Unmount() @@ -292,12 +294,14 @@ func TestCreateMountWithId(t *testing.T) { mount, err := CreateMountWithId("bobolink") assert.NoError(t, err) assert.NotNil(t, mount) + defer func() { assert.NoError(t, mount.Release()) }() err = mount.ReadDefaultConfigFile() assert.NoError(t, err) err = mount.Mount() assert.NoError(t, err) + defer func() { assert.NoError(t, mount.Unmount()) }() // verify the custom entity_id is visible in the 'session ls' output // of mds. @@ -400,6 +404,7 @@ func TestGetSetConfigOption(t *testing.T) { mount, err := CreateMount() require.NoError(t, err) require.NotNil(t, mount) + defer func() { assert.NoError(t, mount.Release()) }() err = mount.SetConfigOption("__dne__", "value") assert.Error(t, err) diff --git a/cephfs/conn_nautilus_test.go b/cephfs/conn_nautilus_test.go index 96a1253..6b9819a 100644 --- a/cephfs/conn_nautilus_test.go +++ b/cephfs/conn_nautilus_test.go @@ -12,6 +12,7 @@ import ( func TestGetFsCid(t *testing.T) { t.Run("unmounted", func(t *testing.T) { mount, err := CreateMount() + defer func() { assert.NoError(t, mount.Release()) }() require.NoError(t, err) require.NotNil(t, mount)