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
This commit is contained in:
Nick Craig-Wood 2019-08-22 11:48:17 +01:00
parent 40cc8180f0
commit 941dde6940

View File

@ -39,6 +39,7 @@ import (
"time" "time"
"github.com/rclone/rclone/fs" "github.com/rclone/rclone/fs"
"github.com/rclone/rclone/fs/cache"
"github.com/rclone/rclone/fs/fserrors" "github.com/rclone/rclone/fs/fserrors"
"github.com/rclone/rclone/fs/object" "github.com/rclone/rclone/fs/object"
"github.com/rclone/rclone/fs/walk" "github.com/rclone/rclone/fs/walk"
@ -165,6 +166,8 @@ func newRunIndividual(t *testing.T, individual bool) *Run {
} }
// Check remote is empty // Check remote is empty
CheckListingWithPrecision(t, r.Fremote, []Item{}, []string{}, r.Fremote.Precision()) CheckListingWithPrecision(t, r.Fremote, []Item{}, []string{}, r.Fremote.Precision())
// Clear the remote cache
cache.Clear()
} }
} }
r.Logf = t.Logf r.Logf = t.Logf
@ -323,4 +326,6 @@ func (r *Run) Finalise() {
r.cleanRemote() r.cleanRemote()
// r.Logf("Cleaning local %q", r.LocalName) // r.Logf("Cleaning local %q", r.LocalName)
r.cleanTempDir() r.cleanTempDir()
// Clear the remote cache
cache.Clear()
} }