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

downloaders: fix flaky TestDownloaders/EnsureDownloader test

Nick Craig-Wood0b4c21fbda33
diff --git a/vfs/vfscache/downloaders/downloaders_test.go b/vfs/vfscache/downloaders/downloaders_test.go
index 8d82c3f99..0b62f5cca 100644
--- a/vfs/vfscache/downloaders/downloaders_test.go
+++ b/vfs/vfscache/downloaders/downloaders_test.go
@@ -122,9 +122,8 @@ func TestDownloaders(t *testing.T) {
r := ranges.Range{Pos: 40 * 1024 * 1024, Size: 250}
err := dls.EnsureDownloader(r)
require.NoError(t, err)
- // FIXME racy test
- assert.False(t, item.HasRange(r))
- time.Sleep(time.Second)
- assert.True(t, item.HasRange(r))
+ assert.Eventually(t, func() bool {
+ return item.HasRange(r)
+ }, 10*time.Second, 10*time.Millisecond)
})
}