From d535ef39de361face2130d2903ffba2c3ced63d3 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Mon, 23 Aug 2021 12:05:36 -0400 Subject: [PATCH] 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 --- cephfs/statx_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cephfs/statx_test.go b/cephfs/statx_test.go index 0592eb7..9f1ca7a 100644 --- a/cephfs/statx_test.go +++ b/cephfs/statx_test.go @@ -18,7 +18,10 @@ func TestStatxFieldsRootDir(t *testing.T) { assert.NotNil(t, st) 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.Gid) assert.NotEqual(t, uint16(0), st.Mode)