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

sync: fix flaky transform tests with retries

Nick Craig-Wooddaacfb6035ac
diff --git a/fs/sync/sync_transform_test.go b/fs/sync/sync_transform_test.go
index 930386a85..0def4d2d7 100644
--- a/fs/sync/sync_transform_test.go
+++ b/fs/sync/sync_transform_test.go
@@ -432,7 +432,10 @@ func TestTransformFile(t *testing.T) {
err = transform.SetOptions(ctx, "all,trimprefix=tic", "all,trimprefix=tac")
require.NoError(t, err)
- err = operations.TransformFile(ctx, r.Fremote, "tictactoe/tictactoe/tictactoe.txt")
+ // Retry to wait for eventual consistency.
+ err = fstest.Retry(t, "TransformFile", func() error {
+ return operations.TransformFile(ctx, r.Fremote, "tictactoe/tictactoe/tictactoe.txt")
+ })
require.NoError(t, err)
r.CheckLocalListing(t, []fstest.Item{}, []string{})
r.CheckRemoteListing(t, []fstest.Item{fstest.NewItem("toe/toe/toe.txt", "hello world", t1)}, []string{"tictacempty_dir", "tictactoe", "tictactoe/tictactoe", "toe", "toe/toe"})
@@ -462,7 +465,10 @@ func TestManualTransformFile(t *testing.T) {
err = transform.SetOptions(ctx, "all,trimprefix=tic", "all,trimprefix=tac")
require.NoError(t, err)
- err = operations.TransformFile(ctx, r.Fremote, "tictactoe/tictactoe/tictactoe.txt")
+ // Retry to wait for eventual consistency.
+ err = fstest.Retry(t, "TransformFile", func() error {
+ return operations.TransformFile(ctx, r.Fremote, "tictactoe/tictactoe/tictactoe.txt")
+ })
require.NoError(t, err)
r.CheckLocalListing(t, []fstest.Item{}, []string{})
r.CheckRemoteListing(t, []fstest.Item{fstest.NewItem("toe/toe/toe.txt", "hello world", t1)}, []string{"tictacempty_dir", "tictactoe", "tictactoe/tictactoe", "toe", "toe/toe"})