From b353c730d8d248c55ab86d9efd889427457b4ab9 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 27 Feb 2019 17:13:54 +0000 Subject: [PATCH] vfs: make tests work on remotes which don't support About --- vfs/vfs_test.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/vfs/vfs_test.go b/vfs/vfs_test.go index 599511754..1aa05550d 100644 --- a/vfs/vfs_test.go +++ b/vfs/vfs_test.go @@ -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