forked from ceph/go-ceph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatx_test.go
33 lines (28 loc) · 1.05 KB
/
statx_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package cephfs
import (
"testing"
"github.com/stretchr/testify/assert"
)
// TestStatxFieldsRootDir does not assert much about every field
// as these can vary between runs. We exercise the getters but
// can only make "lightweight" assertions here.
func TestStatxFieldsRootDir(t *testing.T) {
mount := fsConnect(t)
defer fsDisconnect(t, mount)
st, err := mount.Statx("/", StatxBasicStats, 0)
assert.NoError(t, err)
assert.NotNil(t, st)
assert.Equal(t, StatxBasicStats, st.Mask&StatxBasicStats)
// allow Nlink to be >= 2 in the case that some test(s) don't entirely
// clean up after themselves or the environment is being used outside
// of the go-ceph suite only.
assert.GreaterOrEqual(t, st.Nlink, uint32(2))
assert.Equal(t, uint32(0), st.Uid)
assert.Equal(t, uint32(0), st.Gid)
assert.NotEqual(t, uint16(0), st.Mode)
assert.Equal(t, uint16(0040000), st.Mode&0040000) // is dir?
assert.NotEqual(t, Inode(0), st.Inode)
assert.NotEqual(t, uint64(0), st.Dev)
assert.Equal(t, uint64(0), st.Rdev)
assert.Greater(t, st.Ctime.Sec, int64(1588711788))
}