Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

Retry listing in tests to work around eventual consistency

Nick Craig-Wood2203766f7761
diff --git a/fstest/fstest.go b/fstest/fstest.go
index 74aefb5be..e3d0be2f1 100644
--- a/fstest/fstest.go
+++ b/fstest/fstest.go
@@ -117,7 +117,19 @@ func (is *Items) Done(t *testing.T) {
func CheckListingWithPrecision(t *testing.T, f fs.Fs, items []Item, precision time.Duration) {
is := NewItems(items)
oldErrors := fs.Stats.GetErrors()
- for obj := range f.List() {
+ var objs []fs.Object
+ for i := 1; i <= 5; i++ {
+ objs = nil
+ for obj := range f.List() {
+ objs = append(objs, obj)
+ }
+ if len(objs) == len(items) {
+ break
+ }
+ t.Logf("Sleeping for 1 second for list eventual consistency: %d/5", i)
+ time.Sleep(1 * time.Second)
+ }
+ for _, obj := range objs {
if obj == nil {
t.Errorf("Unexpected nil in List()")
continue