cephfs: make statx test more robust

The TestStatxFieldsRootDir test was assuming that the nlink count
returned by statx would be exactly 2. Make the test more robust against
varying content the root dir of the volume might have by only asserting
that the nlink be 2 or more.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2021-08-23 12:05:36 -04:00 committed by Sven Anderson
parent 528893ce1d
commit d535ef39de
1 changed files with 4 additions and 1 deletions

View File

@ -18,7 +18,10 @@ func TestStatxFieldsRootDir(t *testing.T) {
assert.NotNil(t, st) assert.NotNil(t, st)
assert.Equal(t, StatxBasicStats, st.Mask&StatxBasicStats) assert.Equal(t, StatxBasicStats, st.Mask&StatxBasicStats)
assert.Equal(t, uint32(2), st.Nlink) // 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.Uid)
assert.Equal(t, uint32(0), st.Gid) assert.Equal(t, uint32(0), st.Gid)
assert.NotEqual(t, uint16(0), st.Mode) assert.NotEqual(t, uint16(0), st.Mode)