"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
windows: make tests work properly
Nick Craig-Woodb4e19cfd621d
diff --git a/fs/operations_test.go b/fs/operations_test.goindex 7c2cbaba8..78f0fdbff 100644--- a/fs/operations_test.go+++ b/fs/operations_test.go@@ -10,6 +10,7 @@ import ("log""os""path"+ "path/filepath""regexp""strings""testing"@@ -74,6 +75,7 @@ func TestInit(t *testing.T) {if err != nil {t.Fatalf("Failed to create temp dir: %v", err)}+ localName = filepath.ToSlash(localName)t.Logf("Testing with local %q", localName)flocal, err = fs.NewFs(localName)if err != nil {@@ -83,6 +85,7 @@ func TestInit(t *testing.T) {}func TestCalculateModifyWindow(t *testing.T) {fs.CalculateModifyWindow(fremote, flocal)+ t.Logf("ModifyWindow is %q", fs.Config.ModifyWindow)}func TestMkdir(t *testing.T) {@@ -104,8 +107,8 @@ func TestCopyWithDryRun(t *testing.T) {{Path: "sub dir/hello world", Size: 11, ModTime: t1, Md5sum: "5eb63bbbe01eeed093cb22bb8f5acdc3"},}- fstest.CheckListing(t, flocal, items)- fstest.CheckListing(t, fremote, []fstest.Item{})+ fstest.CheckListingWithPrecision(t, flocal, items, fs.Config.ModifyWindow)+ fstest.CheckListingWithPrecision(t, fremote, []fstest.Item{}, fs.Config.ModifyWindow)}// Now without dry run@@ -119,8 +122,8 @@ func TestCopy(t *testing.T) {{Path: "sub dir/hello world", Size: 11, ModTime: t1, Md5sum: "5eb63bbbe01eeed093cb22bb8f5acdc3"},}- fstest.CheckListing(t, flocal, items)- fstest.CheckListing(t, fremote, items)+ fstest.CheckListingWithPrecision(t, flocal, items, fs.Config.ModifyWindow)+ fstest.CheckListingWithPrecision(t, fremote, items, fs.Config.ModifyWindow)}func TestLsd(t *testing.T) {@@ -145,8 +148,8 @@ func TestCopyAfterDelete(t *testing.T) {items := []fstest.Item{{Path: "sub dir/hello world", Size: 11, ModTime: t1, Md5sum: "5eb63bbbe01eeed093cb22bb8f5acdc3"},}- fstest.CheckListing(t, flocal, []fstest.Item{})- fstest.CheckListing(t, fremote, items)+ fstest.CheckListingWithPrecision(t, flocal, []fstest.Item{}, fs.Config.ModifyWindow)+ fstest.CheckListingWithPrecision(t, fremote, items, fs.Config.ModifyWindow)}func TestCopyRedownload(t *testing.T) {@@ -158,8 +161,8 @@ func TestCopyRedownload(t *testing.T) {items := []fstest.Item{{Path: "sub dir/hello world", Size: 11, ModTime: t1, Md5sum: "5eb63bbbe01eeed093cb22bb8f5acdc3"},}- fstest.CheckListingWithPrecision(t, flocal, items, fremote.Precision())- fstest.CheckListing(t, fremote, items)+ fstest.CheckListingWithPrecision(t, flocal, items, fs.Config.ModifyWindow)+ fstest.CheckListingWithPrecision(t, fremote, items, fs.Config.ModifyWindow)// Clean the directorycleanTempDir(t)@@ -179,8 +182,8 @@ func TestSyncAfterChangingModtimeOnly(t *testing.T) {items := []fstest.Item{{Path: "empty space", Size: 0, ModTime: t2, Md5sum: "d41d8cd98f00b204e9800998ecf8427e"},}- fstest.CheckListing(t, flocal, items)- fstest.CheckListing(t, fremote, items)+ fstest.CheckListingWithPrecision(t, flocal, items, fs.Config.ModifyWindow)+ fstest.CheckListingWithPrecision(t, fremote, items, fs.Config.ModifyWindow)}func TestSyncAfterAddingAFile(t *testing.T) {@@ -193,8 +196,8 @@ func TestSyncAfterAddingAFile(t *testing.T) {{Path: "empty space", Size: 0, ModTime: t2, Md5sum: "d41d8cd98f00b204e9800998ecf8427e"},{Path: "potato", Size: 60, ModTime: t3, Md5sum: "d6548b156ea68a4e003e786df99eee76"},}- fstest.CheckListing(t, flocal, items)- fstest.CheckListing(t, fremote, items)+ fstest.CheckListingWithPrecision(t, flocal, items, fs.Config.ModifyWindow)+ fstest.CheckListingWithPrecision(t, fremote, items, fs.Config.ModifyWindow)}func TestSyncAfterChangingFilesSizeOnly(t *testing.T) {@@ -207,8 +210,8 @@ func TestSyncAfterChangingFilesSizeOnly(t *testing.T) {{Path: "empty space", Size: 0, ModTime: t2, Md5sum: "d41d8cd98f00b204e9800998ecf8427e"},{Path: "potato", Size: 21, ModTime: t3, Md5sum: "100defcf18c42a1e0dc42a789b107cd2"},}- fstest.CheckListing(t, flocal, items)- fstest.CheckListing(t, fremote, items)+ fstest.CheckListingWithPrecision(t, flocal, items, fs.Config.ModifyWindow)+ fstest.CheckListingWithPrecision(t, fremote, items, fs.Config.ModifyWindow)}// Sync after changing a file's contents, modtime but not length@@ -222,8 +225,8 @@ func TestSyncAfterChangingContentsOnly(t *testing.T) {{Path: "empty space", Size: 0, ModTime: t2, Md5sum: "d41d8cd98f00b204e9800998ecf8427e"},{Path: "potato", Size: 21, ModTime: t2, Md5sum: "e4cb6955d9106df6263c45fcfc10f163"},}- fstest.CheckListing(t, flocal, items)- fstest.CheckListing(t, fremote, items)+ fstest.CheckListingWithPrecision(t, flocal, items, fs.Config.ModifyWindow)+ fstest.CheckListingWithPrecision(t, fremote, items, fs.Config.ModifyWindow)}// Sync after removing a file and adding a file --dry-run@@ -248,8 +251,8 @@ func TestSyncAfterRemovingAFileAndAddingAFileDryRun(t *testing.T) {{Path: "empty space", Size: 0, ModTime: t2, Md5sum: "d41d8cd98f00b204e9800998ecf8427e"},{Path: "potato2", Size: 60, ModTime: t1, Md5sum: "d6548b156ea68a4e003e786df99eee76"},}- fstest.CheckListing(t, flocal, items)- fstest.CheckListing(t, fremote, before)+ fstest.CheckListingWithPrecision(t, flocal, items, fs.Config.ModifyWindow)+ fstest.CheckListingWithPrecision(t, fremote, before, fs.Config.ModifyWindow)}// Sync after removing a file and adding a file@@ -262,8 +265,8 @@ func TestSyncAfterRemovingAFileAndAddingAFile(t *testing.T) {{Path: "empty space", Size: 0, ModTime: t2, Md5sum: "d41d8cd98f00b204e9800998ecf8427e"},{Path: "potato2", Size: 60, ModTime: t1, Md5sum: "d6548b156ea68a4e003e786df99eee76"},}- fstest.CheckListing(t, flocal, items)- fstest.CheckListing(t, fremote, items)+ fstest.CheckListingWithPrecision(t, flocal, items, fs.Config.ModifyWindow)+ fstest.CheckListingWithPrecision(t, fremote, items, fs.Config.ModifyWindow)}func TestLs(t *testing.T) {diff --git a/fstest/fstest.go b/fstest/fstest.goindex 760b1194b..dfcd0db2a 100644--- a/fstest/fstest.go+++ b/fstest/fstest.go@@ -9,6 +9,7 @@ import ("log""math/rand""os"+ "path/filepath""strings""testing""time"@@ -80,6 +81,7 @@ func (is *Items) Find(t *testing.T, obj fs.Object, precision time.Duration) {i, ok := is.byName[obj.Remote()]if !ok {t.Errorf("Unexpected file %q", obj.Remote())+ return}delete(is.byName, obj.Remote())i.Check(t, obj, precision)@@ -140,6 +142,7 @@ func LocalRemote() (path string, err error) {// Now remove the directoryerr = os.Remove(path)}+ path = filepath.ToSlash(path)return}