From e56f10f3b4d60555ba3d16186553fc678b8e90d4 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Thu, 8 Jul 2021 09:49:10 -0400 Subject: [PATCH] cephfs admin: make fsConnect utility function more flexible The fsConnect function is used by the tests to support getting a data-path cephfs connection, in order to support those fs admin tests that need to make changes in the file system directly. The new second argument to the call allows for the cephfs connection to be made with a non-default configuration. Signed-off-by: John Mulligan --- cephfs/admin/workflow_test.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cephfs/admin/workflow_test.go b/cephfs/admin/workflow_test.go index f5a1c0e..d0fcfed 100644 --- a/cephfs/admin/workflow_test.go +++ b/cephfs/admin/workflow_test.go @@ -19,13 +19,18 @@ import ( var snapDir = ".snapshots" -func fsConnect(t *testing.T) *cephfs.MountInfo { +func fsConnect(t *testing.T, configFile string) *cephfs.MountInfo { mount, err := cephfs.CreateMount() require.NoError(t, err) require.NotNil(t, mount) - err = mount.ReadDefaultConfigFile() - require.NoError(t, err) + if configFile == "" { + err = mount.ReadDefaultConfigFile() + require.NoError(t, err) + } else { + err = mount.ReadConfigFile(configFile) + require.NoError(t, err) + } err = mount.SetConfigOption("client_snapdir", snapDir) require.NoError(t, err) @@ -114,7 +119,7 @@ func TestWorkflow(t *testing.T) { require.NotEqual(t, "", subPath) // connect to volume, cd to path (?) - mount := fsConnect(t) + mount := fsConnect(t, "") defer func(mount *cephfs.MountInfo) { assert.NoError(t, mount.Unmount()) assert.NoError(t, mount.Release())