mirror of
https://github.com/ceph/go-ceph
synced 2024-12-25 15:42:30 +00:00
3f52ea219a
noahdesu -> ceph Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
67 lines
1.3 KiB
Go
67 lines
1.3 KiB
Go
package cephfs_test
|
|
|
|
import "testing"
|
|
import "github.com/ceph/go-ceph/cephfs"
|
|
import "github.com/stretchr/testify/assert"
|
|
|
|
func TestCreateMount(t *testing.T) {
|
|
mount, err := cephfs.CreateMount()
|
|
assert.NoError(t, err)
|
|
assert.NotNil(t, mount)
|
|
}
|
|
|
|
func TestMountRoot(t *testing.T) {
|
|
mount, err := cephfs.CreateMount()
|
|
assert.NoError(t, err)
|
|
assert.NotNil(t, mount)
|
|
|
|
err = mount.ReadDefaultConfigFile()
|
|
assert.NoError(t, err)
|
|
|
|
err = mount.Mount()
|
|
assert.NoError(t, err)
|
|
}
|
|
|
|
func TestSyncFs(t *testing.T) {
|
|
mount, err := cephfs.CreateMount()
|
|
assert.NoError(t, err)
|
|
assert.NotNil(t, mount)
|
|
|
|
err = mount.ReadDefaultConfigFile()
|
|
assert.NoError(t, err)
|
|
|
|
err = mount.Mount()
|
|
assert.NoError(t, err)
|
|
|
|
err = mount.SyncFs()
|
|
assert.NoError(t, err)
|
|
}
|
|
|
|
func TestChangeDir(t *testing.T) {
|
|
mount, err := cephfs.CreateMount()
|
|
assert.NoError(t, err)
|
|
assert.NotNil(t, mount)
|
|
|
|
err = mount.ReadDefaultConfigFile()
|
|
assert.NoError(t, err)
|
|
|
|
err = mount.Mount()
|
|
assert.NoError(t, err)
|
|
|
|
dir1 := mount.CurrentDir()
|
|
assert.NotNil(t, dir1)
|
|
|
|
err = mount.MakeDir("/asdf", 0755)
|
|
assert.NoError(t, err)
|
|
|
|
err = mount.ChangeDir("/asdf")
|
|
assert.NoError(t, err)
|
|
|
|
dir2 := mount.CurrentDir()
|
|
assert.NotNil(t, dir2)
|
|
|
|
assert.NotEqual(t, dir1, dir2)
|
|
assert.Equal(t, dir1, "/")
|
|
assert.Equal(t, dir2, "/asdf")
|
|
}
|