2023-02-13 21:12:17 +00:00
|
|
|
package cephfs
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMakeDirs(t *testing.T) {
|
|
|
|
mount := fsConnect(t)
|
|
|
|
defer fsDisconnect(t, mount)
|
|
|
|
|
|
|
|
dir1 := "/base/sub/way"
|
2023-08-14 13:18:43 +00:00
|
|
|
err := mount.MakeDirs(dir1, 0o755)
|
2023-02-13 21:12:17 +00:00
|
|
|
assert.NoError(t, err)
|
|
|
|
defer func() {
|
|
|
|
assert.NoError(t, mount.RemoveDir("/base/sub/way"))
|
|
|
|
assert.NoError(t, mount.RemoveDir("/base/sub"))
|
|
|
|
assert.NoError(t, mount.RemoveDir("/base"))
|
|
|
|
}()
|
|
|
|
|
|
|
|
dir, err := mount.OpenDir(dir1)
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.NotNil(t, dir)
|
|
|
|
err = dir.Close()
|
|
|
|
assert.NoError(t, err)
|
|
|
|
}
|