mirror of
https://github.com/ceph/go-ceph
synced 2024-12-23 06:33:24 +00:00
cephfs: add a test case for calling Statx on an invalid mount
Adding this test case gets test coverage to 100% for path.go. Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
7cbacf9331
commit
36abb07dc5
@ -359,23 +359,31 @@ func TestReadlink(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStatx(t *testing.T) {
|
||||
mount := fsConnect(t)
|
||||
defer fsDisconnect(t, mount)
|
||||
t.Run("statPath", func(t *testing.T) {
|
||||
mount := fsConnect(t)
|
||||
defer fsDisconnect(t, mount)
|
||||
|
||||
dirname := "statme"
|
||||
assert.NoError(t, mount.MakeDir(dirname, 0755))
|
||||
dirname := "statme"
|
||||
assert.NoError(t, mount.MakeDir(dirname, 0755))
|
||||
|
||||
st, err := mount.Statx(dirname, StatxBasicStats, 0)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, st)
|
||||
assert.Equal(t, uint16(0755), st.Mode&0777)
|
||||
st, err := mount.Statx(dirname, StatxBasicStats, 0)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, st)
|
||||
assert.Equal(t, uint16(0755), st.Mode&0777)
|
||||
|
||||
assert.NoError(t, mount.RemoveDir(dirname))
|
||||
assert.NoError(t, mount.RemoveDir(dirname))
|
||||
|
||||
st, err = mount.Statx(dirname, StatxBasicStats, 0)
|
||||
assert.Error(t, err)
|
||||
assert.Nil(t, st)
|
||||
assert.Equal(t, errNoEntry, err)
|
||||
st, err = mount.Statx(dirname, StatxBasicStats, 0)
|
||||
assert.Error(t, err)
|
||||
assert.Nil(t, st)
|
||||
assert.Equal(t, errNoEntry, err)
|
||||
})
|
||||
|
||||
t.Run("invalidMount", func(t *testing.T) {
|
||||
m := &MountInfo{}
|
||||
_, err := m.Statx("junk", StatxBasicStats, 0)
|
||||
assert.Error(t, err)
|
||||
})
|
||||
}
|
||||
|
||||
func TestRename(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user