vfs: fix tests for Statfs when running on backends with unknowns

This was broken in da41db4712
This commit is contained in:
Nick Craig-Wood 2020-04-22 17:56:45 +01:00
parent 8176202e6d
commit 86eaf43b00

View File

@ -280,9 +280,9 @@ func TestVFSStatfs(t *testing.T) {
// read
total, used, free := vfs.Statfs()
if !aboutSupported {
assert.Equal(t, int64(-1), total)
assert.Equal(t, int64(-1), free)
assert.Equal(t, int64(-1), used)
assert.Equal(t, int64(unknownFreeBytes), total)
assert.Equal(t, int64(unknownFreeBytes), free)
assert.Equal(t, int64(0), used)
return // can't test anything else if About not supported
}
require.NotNil(t, vfs.usage)
@ -290,17 +290,17 @@ func TestVFSStatfs(t *testing.T) {
if vfs.usage.Total != nil {
assert.Equal(t, *vfs.usage.Total, total)
} else {
assert.Equal(t, int64(-1), total)
assert.True(t, total >= int64(unknownFreeBytes))
}
if vfs.usage.Free != nil {
assert.Equal(t, *vfs.usage.Free, free)
} else {
assert.Equal(t, int64(-1), free)
assert.True(t, free >= int64(unknownFreeBytes))
}
if vfs.usage.Used != nil {
assert.Equal(t, *vfs.usage.Used, used)
} else {
assert.Equal(t, int64(-1), used)
assert.Equal(t, int64(0), used)
}
// read cached