"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
fs: Make tests create a new bucket rather than purging the old one
Nick Craig-Woodf682002b8487
diff --git a/fs/sync_test.go b/fs/sync_test.goindex 6e980670a..e09d29c3e 100644--- a/fs/sync_test.go+++ b/fs/sync_test.go@@ -687,7 +687,11 @@ func TestSyncWithTrackRenames(t *testing.T) {}// Test a server side move if possible, or the backup path if not-func testServerSideMove(t *testing.T, r *Run, fremoteMove fs.Fs, withFilter bool) {+func testServerSideMove(t *testing.T, r *Run, withFilter bool) {+ fremoteMove, _, finaliseMove, err := fstest.RandomRemote(*fstest.RemoteName, *fstest.SubDir)+ require.NoError(t, err)+ defer finaliseMove()+file1 := r.WriteBoth("potato2", "------------------------------------------------------------", t1)file2 := r.WriteBoth("empty space", "", t2)file3u := r.WriteBoth("potato3", "------------------------------------------------------------ UPDATED", t2)@@ -703,7 +707,7 @@ func testServerSideMove(t *testing.T, r *Run, fremoteMove fs.Fs, withFilter bool// Do server side movefs.Stats.ResetCounters()- err := fs.MoveDir(fremoteMove, r.fremote)+ err = fs.MoveDir(fremoteMove, r.fremote)require.NoError(t, err)if withFilter {@@ -713,20 +717,21 @@ func testServerSideMove(t *testing.T, r *Run, fremoteMove fs.Fs, withFilter bool}fstest.CheckItems(t, fremoteMove, file2, file1, file3u)- // Purge the original before moving- require.NoError(t, fs.Purge(r.fremote))- fstest.CheckItems(t, r.fremote)+ // Create a new empty remote for stuff to be moved into+ fremoteMove2, _, finaliseMove2, err := fstest.RandomRemote(*fstest.RemoteName, *fstest.SubDir)+ require.NoError(t, err)+ defer finaliseMove2()- // Move it back again, dst does not exist this time+ // Move it back to a new empty remote, dst does not exist this timefs.Stats.ResetCounters()- err = fs.MoveDir(r.fremote, fremoteMove)+ err = fs.MoveDir(fremoteMove2, fremoteMove)require.NoError(t, err)if withFilter {- fstest.CheckItems(t, r.fremote, file1, file3u)+ fstest.CheckItems(t, fremoteMove2, file1, file3u)fstest.CheckItems(t, fremoteMove, file2)} else {- fstest.CheckItems(t, r.fremote, file2, file1, file3u)+ fstest.CheckItems(t, fremoteMove2, file2, file1, file3u)fstest.CheckItems(t, fremoteMove)}}@@ -735,10 +740,7 @@ func testServerSideMove(t *testing.T, r *Run, fremoteMove fs.Fs, withFilter boolfunc TestServerSideMove(t *testing.T) {r := NewRun(t)defer r.Finalise()- fremoteMove, _, finaliseMove, err := fstest.RandomRemote(*fstest.RemoteName, *fstest.SubDir)- require.NoError(t, err)- defer finaliseMove()- testServerSideMove(t, r, fremoteMove, false)+ testServerSideMove(t, r, false)}// Test a server side move if possible, or the backup path if not@@ -751,10 +753,7 @@ func TestServerSideMoveWithFilter(t *testing.T) {fs.Config.Filter.MinSize = -1}()- fremoteMove, _, finaliseMove, err := fstest.RandomRemote(*fstest.RemoteName, *fstest.SubDir)- require.NoError(t, err)- defer finaliseMove()- testServerSideMove(t, r, fremoteMove, true)+ testServerSideMove(t, r, true)}// Test a server side move with overlap