mirror of https://github.com/ceph/go-ceph
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 <jmulligan@redhat.com>
This commit is contained in:
parent
df3c6dae2e
commit
e56f10f3b4
|
@ -19,13 +19,18 @@ import (
|
||||||
|
|
||||||
var snapDir = ".snapshots"
|
var snapDir = ".snapshots"
|
||||||
|
|
||||||
func fsConnect(t *testing.T) *cephfs.MountInfo {
|
func fsConnect(t *testing.T, configFile string) *cephfs.MountInfo {
|
||||||
mount, err := cephfs.CreateMount()
|
mount, err := cephfs.CreateMount()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NotNil(t, mount)
|
require.NotNil(t, mount)
|
||||||
|
|
||||||
err = mount.ReadDefaultConfigFile()
|
if configFile == "" {
|
||||||
require.NoError(t, err)
|
err = mount.ReadDefaultConfigFile()
|
||||||
|
require.NoError(t, err)
|
||||||
|
} else {
|
||||||
|
err = mount.ReadConfigFile(configFile)
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
err = mount.SetConfigOption("client_snapdir", snapDir)
|
err = mount.SetConfigOption("client_snapdir", snapDir)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
@ -114,7 +119,7 @@ func TestWorkflow(t *testing.T) {
|
||||||
require.NotEqual(t, "", subPath)
|
require.NotEqual(t, "", subPath)
|
||||||
|
|
||||||
// connect to volume, cd to path (?)
|
// connect to volume, cd to path (?)
|
||||||
mount := fsConnect(t)
|
mount := fsConnect(t, "")
|
||||||
defer func(mount *cephfs.MountInfo) {
|
defer func(mount *cephfs.MountInfo) {
|
||||||
assert.NoError(t, mount.Unmount())
|
assert.NoError(t, mount.Unmount())
|
||||||
assert.NoError(t, mount.Release())
|
assert.NoError(t, mount.Release())
|
||||||
|
|
Loading…
Reference in New Issue