From 941dde6940c75ff221c0b3de69c26f205c603870 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 22 Aug 2019 11:48:17 +0100 Subject: [PATCH] fstest: clear the fs cache between test runs The fs cache makes test runs no longer independent and this can cause a problem with some tests. Clearing the fs cache between tests runs fixes the problem. This was spotted by @cenkalti as part of merging #3469 --- fstest/run.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fstest/run.go b/fstest/run.go index 042abc9a3..5267ca388 100644 --- a/fstest/run.go +++ b/fstest/run.go @@ -39,6 +39,7 @@ import ( "time" "github.com/rclone/rclone/fs" + "github.com/rclone/rclone/fs/cache" "github.com/rclone/rclone/fs/fserrors" "github.com/rclone/rclone/fs/object" "github.com/rclone/rclone/fs/walk" @@ -165,6 +166,8 @@ func newRunIndividual(t *testing.T, individual bool) *Run { } // Check remote is empty CheckListingWithPrecision(t, r.Fremote, []Item{}, []string{}, r.Fremote.Precision()) + // Clear the remote cache + cache.Clear() } } r.Logf = t.Logf @@ -323,4 +326,6 @@ func (r *Run) Finalise() { r.cleanRemote() // r.Logf("Cleaning local %q", r.LocalName) r.cleanTempDir() + // Clear the remote cache + cache.Clear() }