cephfs: remove a use of external mount of test fs

The external mount point was mainly used for stat prior to a Stat
function being part of go-ceph's cephfs package. Now that we have
Statx, we can replace the need for the external mount and os.Stat.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2021-03-12 10:41:24 -05:00 committed by mergify[bot]
parent 1c72979ce0
commit 3b9317b608

View File

@ -3,9 +3,6 @@
package cephfs package cephfs
import ( import (
"os"
"path"
"syscall"
"testing" "testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
@ -33,13 +30,12 @@ func TestSetMountPerms(t *testing.T) {
defer func() { assert.NoError(t, mount.Unmount()) }() defer func() { assert.NoError(t, mount.Unmount()) }()
t.Run("checkStat", func(t *testing.T) { t.Run("checkStat", func(t *testing.T) {
useMount(t)
dirname := "/check-mount-perms" dirname := "/check-mount-perms"
err := mount.MakeDir(dirname, 0755) err := mount.MakeDir(dirname, 0755)
assert.NoError(t, err) assert.NoError(t, err)
defer mount.RemoveDir(dirname) defer mount.RemoveDir(dirname)
s, err := os.Stat(path.Join(CephMountDir, dirname)) sx, err := mount.Statx(dirname, StatxBasicStats, 0)
require.NoError(t, err) require.NoError(t, err)
assert.EqualValues(t, s.Sys().(*syscall.Stat_t).Gid, 500) assert.EqualValues(t, sx.Gid, 500)
}) })
} }