mirror of
https://github.com/ceph/go-ceph
synced 2024-12-11 08:57:13 +00:00
0f4cf26919
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
67 lines
1.4 KiB
Go
67 lines
1.4 KiB
Go
package cephfs_test
|
|
|
|
import "testing"
|
|
import "github.com/noahdesu/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")
|
|
}
|