From 1bd336586896a09738e0458fe8f6a409779d66d7 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 25 May 2020 16:46:56 +0100 Subject: [PATCH] vfs: fix TestVFSStatfs with known total, used and unknown free --- vfs/vfs_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vfs/vfs_test.go b/vfs/vfs_test.go index 3d6bf8b36..7cfc35155 100644 --- a/vfs/vfs_test.go +++ b/vfs/vfs_test.go @@ -295,7 +295,11 @@ func TestVFSStatfs(t *testing.T) { if vfs.usage.Free != nil { assert.Equal(t, *vfs.usage.Free, free) } else { - assert.True(t, free >= int64(unknownFreeBytes)) + if vfs.usage.Total != nil && vfs.usage.Used != nil { + assert.Equal(t, free, total-used) + } else { + assert.True(t, free >= int64(unknownFreeBytes)) + } } if vfs.usage.Used != nil { assert.Equal(t, *vfs.usage.Used, used)