"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
Add optional interface DirCacheFlush for making the tests more reliable
Nick Craig-Wood48a2e3844df8
diff --git a/amazonclouddrive/amazonclouddrive.go b/amazonclouddrive/amazonclouddrive.goindex 5190aa3dc..770bee3f4 100644--- a/amazonclouddrive/amazonclouddrive.go+++ b/amazonclouddrive/amazonclouddrive.go@@ -636,6 +636,11 @@ func (f *Fs) Move(src fs.Object, remote string) (fs.Object, error) {}fs.Debug(src, "Attempting to move to %q", remote)return srcObj.move(remote, false)++// DirCacheFlush resets the directory cache - used in testing as an+// optional interface+func (f *Fs) DirCacheFlush() {+ f.dirCache.ResetRoot()}// DirMove moves src directory to this remote using server side move@@ -1122,8 +1127,9 @@ var (_ fs.Fs = (*Fs)(nil)_ fs.Purger = (*Fs)(nil)// _ fs.Copier = (*Fs)(nil)- _ fs.Mover = (*Fs)(nil)- _ fs.DirMover = (*Fs)(nil)- _ fs.Object = (*Object)(nil)- _ fs.MimeTyper = &Object{}+ _ fs.Mover = (*Fs)(nil)+ _ fs.DirMover = (*Fs)(nil)+ _ fs.DirCacheFlusher = (*Fs)(nil)+ _ fs.Object = (*Object)(nil)+ _ fs.MimeTyper = &Object{})diff --git a/drive/drive.go b/drive/drive.goindex c362ee6ae..14039a7b1 100644--- a/drive/drive.go+++ b/drive/drive.go@@ -799,6 +799,12 @@ func (f *Fs) DirMove(src fs.Fs) error {return nil}+// DirCacheFlush resets the directory cache - used in testing as an+// optional interface+func (f *Fs) DirCacheFlush() {+ f.dirCache.ResetRoot()+}+// Hashes returns the supported hash sets.func (f *Fs) Hashes() fs.HashSet {return fs.HashSet(fs.HashMD5)@@ -1079,12 +1085,13 @@ func (o *Object) MimeType() string {// Check the interfaces are satisfiedvar (- _ fs.Fs = (*Fs)(nil)- _ fs.Purger = (*Fs)(nil)- _ fs.Copier = (*Fs)(nil)- _ fs.Mover = (*Fs)(nil)- _ fs.DirMover = (*Fs)(nil)- _ fs.PutUncheckeder = (*Fs)(nil)- _ fs.Object = (*Object)(nil)- _ fs.MimeTyper = &Object{}+ _ fs.Fs = (*Fs)(nil)+ _ fs.Purger = (*Fs)(nil)+ _ fs.Copier = (*Fs)(nil)+ _ fs.Mover = (*Fs)(nil)+ _ fs.DirMover = (*Fs)(nil)+ _ fs.DirCacheFlusher = (*Fs)(nil)+ _ fs.PutUncheckeder = (*Fs)(nil)+ _ fs.Object = (*Object)(nil)+ _ fs.MimeTyper = &Object{})diff --git a/fs/fs.go b/fs/fs.goindex 592245595..42939fc26 100644--- a/fs/fs.go+++ b/fs/fs.go@@ -275,6 +275,13 @@ type UnWrapper interface {UnWrap() Fs}+// DirCacheFlusher is an optional interface for Fs+type DirCacheFlusher interface {+ // DirCacheFlush resets the directory cache - used in testing+ // as an optional interface+ DirCacheFlush()+}+// PutUncheckeder is an optional interface for Fstype PutUncheckeder interface {// Put in to the remote path with the modTime given of the given sizediff --git a/fstest/fstest.go b/fstest/fstest.goindex 148e4034b..5503d5828 100644--- a/fstest/fstest.go+++ b/fstest/fstest.go@@ -175,6 +175,10 @@ func CheckListingWithPrecision(t *testing.T, f fs.Fs, items []Item, expectedDirssleep *= 2t.Logf("Sleeping for %v for list eventual consistency: %d/%d", sleep, i, retries)time.Sleep(sleep)+ if do, ok := f.(fs.DirCacheFlusher); ok {+ t.Logf("Flushing the directory cache")+ do.DirCacheFlush()+ }}for _, obj := range objs {require.NotNil(t, obj)diff --git a/onedrive/onedrive.go b/onedrive/onedrive.goindex 744b3397e..aa1740fed 100644--- a/onedrive/onedrive.go+++ b/onedrive/onedrive.go@@ -635,6 +635,12 @@ func (f *Fs) Purge() error {return f.purgeCheck("", false)}+// DirCacheFlush resets the directory cache - used in testing as an+// optional interface+func (f *Fs) DirCacheFlush() {+ f.dirCache.ResetRoot()+}+// Hashes returns the supported hash sets.func (f *Fs) Hashes() fs.HashSet {return fs.HashSet(fs.HashSHA1)@@ -960,6 +966,7 @@ var (_ fs.Copier = (*Fs)(nil)// _ fs.Mover = (*Fs)(nil)// _ fs.DirMover = (*Fs)(nil)- _ fs.Object = (*Object)(nil)- _ fs.MimeTyper = &Object{}+ _ fs.DirCacheFlusher = (*Fs)(nil)+ _ fs.Object = (*Object)(nil)+ _ fs.MimeTyper = &Object{})