mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 09:32:29 +08:00
vfs: make tests work on remotes which don't support About
This commit is contained in:
parent
173dfbd051
commit
b353c730d8
|
@ -263,24 +263,32 @@ func TestVFSStatfs(t *testing.T) {
|
|||
assert.Nil(t, vfs.usage)
|
||||
assert.True(t, vfs.usageTime.IsZero())
|
||||
|
||||
aboutSupported := r.Fremote.Features().About != nil
|
||||
|
||||
// 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)
|
||||
return // can't test anything else if About not supported
|
||||
}
|
||||
require.NotNil(t, vfs.usage)
|
||||
assert.False(t, vfs.usageTime.IsZero())
|
||||
if vfs.usage.Total != nil {
|
||||
assert.Equal(t, *vfs.usage.Total, total)
|
||||
} else {
|
||||
assert.Equal(t, -1, total)
|
||||
assert.Equal(t, int64(-1), total)
|
||||
}
|
||||
if vfs.usage.Free != nil {
|
||||
assert.Equal(t, *vfs.usage.Free, free)
|
||||
} else {
|
||||
assert.Equal(t, -1, free)
|
||||
assert.Equal(t, int64(-1), free)
|
||||
}
|
||||
if vfs.usage.Used != nil {
|
||||
assert.Equal(t, *vfs.usage.Used, used)
|
||||
} else {
|
||||
assert.Equal(t, -1, used)
|
||||
assert.Equal(t, int64(-1), used)
|
||||
}
|
||||
|
||||
// read cached
|
||||
|
|
Loading…
Reference in New Issue
Block a user