"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
bisync: fix integration tests skipping the special-character cases
nielash7b63879af5e5
diff --git a/cmd/bisync/bisync_test.go b/cmd/bisync/bisync_test.goindex ead511beb..f41fdc58d 100644--- a/cmd/bisync/bisync_test.go+++ b/cmd/bisync/bisync_test.go@@ -1104,26 +1104,31 @@ func (b *bisyncTest) checkPreReqs(ctx context.Context, opt *bisync.Options) (contestSetModtime(b.fs2)}- if b.testCase == "normalization" || b.testCase == "extended_char_paths" || b.testCase == "extended_filenames" {+ if b.testCase == "normalization" || b.testCase == "extended_filenames" {// test whether remote is capable of running testconst chars = "ě{chr:81}{chr:fe}{spc}áñhࢺ_測試Рускийěáñ👸🏼🧝🏾♀️💆🏿♂️🐨🤙🏼🤮🧑🏻🔧🧑🔬éö"testfilename1 := splitLine(norm.NFD.String(norm.NFC.String(chars)))[0]testfilename2 := splitLine(norm.NFC.String(norm.NFD.String(chars)))[0]tempDir, err := cache.Get(ctx, b.tempDir)require.NoError(b.t, err)+ ctx := accounting.WithStatsGroup(ctx, random.String(8)) // keep stats separatepreTest := func(f fs.Fs, testfilename string) string {+ // the path roots already hold the scenario's files, so probe in a fresh dir+ dir := "pretest-" + strings.ToLower(random.String(8))in := bytes.NewBufferString(testfilename)- objinfo := object.NewStaticObjectInfo(testfilename, initDate, int64(len(testfilename)), true, nil, nil)+ objinfo := object.NewStaticObjectInfo(path.Join(dir, testfilename), initDate, int64(len(testfilename)), true, nil, nil)obj, err := f.Put(ctx, in, objinfo)if err != nil {b.t.Skipf("Fs is incapable of running test, skipping: %s (expected: \n%s (%s) actual: \n%s (%v))\n (fs: %s) \n", b.testCase, testfilename, detectEncoding(testfilename), "upload failed", err, f)}- entries, err := f.List(ctx, "")- assert.NoError(b.t, err)- if entries.Len() == 1 && entries[0].Remote() != testfilename {- diffStr, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{A: []string{testfilename}, B: []string{entries[0].Remote()}})+ entries, err := f.List(ctx, dir)+ require.NoError(b.t, err)+ require.Equal(b.t, 1, entries.Len())+ got := path.Base(entries[0].Remote())+ if got != testfilename {+ diffStr, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{A: []string{testfilename}, B: []string{got}})// we can still deal with this as long as both remotes auto-convert the same way.- b.t.Logf("Warning: this remote seems to auto-convert special characters (testcase: %s) (expected: \n%s (%s) actual: \n%s (%s))\n (fs: %s) \n%v", b.testCase, testfilename, detectEncoding(testfilename), entries[0].Remote(), detectEncoding(entries[0].Remote()), f, diffStr)+ b.t.Logf("Warning: this remote seems to auto-convert special characters (testcase: %s) (expected: \n%s (%s) actual: \n%s (%s))\n (fs: %s) \n%v", b.testCase, testfilename, detectEncoding(testfilename), got, detectEncoding(got), f, diffStr)}// test whether we can fix-casectxFixCase, ci := fs.AddConfig(ctx)@@ -1140,7 +1145,12 @@ func (b *bisyncTest) checkPreReqs(ctx context.Context, opt *bisync.Options) (conif obj != nil {require.NoError(b.t, upperObj.Remove(ctx))}- return entries[0].Remote()+ for _, d := range []fs.Fs{f, tempDir} {+ if err := d.Rmdir(ctx, dir); err != nil && !errors.Is(err, fs.ErrorDirNotFound) {+ require.NoError(b.t, err)+ }+ }+ return got}got1 := preTest(b.fs1, testfilename1)got1 += preTest(b.fs1, testfilename2)diff --git a/cmd/bisync/testdata/test_extended_filenames/golden/test.log b/cmd/bisync/testdata/test_extended_filenames/golden/test.logindex eda13848c..aaa1d5ec1 100644--- a/cmd/bisync/testdata/test_extended_filenames/golden/test.log+++ b/cmd/bisync/testdata/test_extended_filenames/golden/test.log@@ -25,7 +25,9 @@ INFO : Bisyncing with Comparison Settings:INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"INFO : Copying Path2 files to Path1INFO : - [34mPath2[0m [35mResync is copying files to[0m - [36mPath1[0m+INFO : There was nothing to transferINFO : - [36mPath1[0m [35mResync is copying files to[0m - [36mPath2[0m+INFO : There was nothing to transferINFO : Resync updating listingsINFO : Validating listings for Path1 "{path1/}" vs Path2 "{path2/}"INFO : [32mBisync successful[0mdiff --git a/cmd/bisync/testdata/test_normalization/golden/test.log b/cmd/bisync/testdata/test_normalization/golden/test.logindex aea5f4161..ef40e7c0e 100644--- a/cmd/bisync/testdata/test_normalization/golden/test.log+++ b/cmd/bisync/testdata/test_normalization/golden/test.log@@ -17,6 +17,7 @@ INFO : Bisyncing with Comparison Settings:INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"INFO : Copying Path2 files to Path1INFO : - [34mPath2[0m [35mResync is copying files to[0m - [36mPath1[0m+INFO : There was nothing to transferINFO : - [36mPath1[0m [35mResync is copying files to[0m - [36mPath2[0mINFO : Resync updating listingsINFO : Validating listings for Path1 "{path1/}" vs Path2 "{path2/}"@@ -150,6 +151,7 @@ INFO : - [34mPath2[0m [35m[32mQueue copy to[0m Path1[0m - [36m{INFO : - [36mPath1[0m [35m[32mQueue copy to[0m Path2[0m - [36m"{path2/}測試_Руский___ě_áñ👸🏼🧝🏾\u200d♀️💆🏿\u200d♂️🐨🤙🏼🤮🧑🏻\u200d🔧🧑\u200d🔬éö/測試_Руский___ě_áñ👸🏼🧝🏾\u200d♀️💆🏿\u200d♂️🐨🤙🏼🤮🧑🏻\u200d🔧🧑\u200d🔬éö.txt"[0mINFO : - [34mPath2[0m [35m[32mQueue copy to[0m Path1[0m - [36m{path1/}file1.txt[0mINFO : - [34mPath2[0m [35mDo queued copies to[0m - [36mPath1[0m+INFO : There was nothing to transferINFO : - [36mPath1[0m [35mDo queued copies to[0m - [36mPath2[0mINFO : Updating listingsINFO : Validating listings for Path1 "{path1/}" vs Path2 "{path2/}"@@ -170,7 +172,9 @@ INFO : Bisyncing with Comparison Settings:INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"INFO : Copying Path2 files to Path1INFO : - [34mPath2[0m [35mResync is copying files to[0m - [36mPath1[0m+INFO : There was nothing to transferINFO : - [36mPath1[0m [35mResync is copying files to[0m - [36mPath2[0m+INFO : There was nothing to transferINFO : Resync updating listingsINFO : Validating listings for Path1 "{path1/}" vs Path2 "{path2/}"INFO : [32mBisync successful[0m@@ -209,7 +213,9 @@ INFO : - [36mPath1[0m [35m[32mQueue copy to[0m Path2[0m - [36m{INFO : - [36mPath1[0m [35m[32mQueue copy to[0m Path2[0m - [36m"{path2/}測試_Руский___ě_áñ👸🏼🧝🏾\u200d♀️💆🏿\u200d♂️🐨🤙🏼🤮🧑🏻\u200d🔧🧑\u200d🔬éö/測試_Руский___ě_áñ👸🏼🧝🏾\u200d♀️💆🏿\u200d♂️🐨🤙🏼🤮🧑🏻\u200d🔧🧑\u200d🔬éö.txt"[0mINFO : - [34mPath2[0m [35m[32mQueue copy to[0m Path1[0m - [36m{path1/}file1.txt[0mINFO : - [34mPath2[0m [35mDo queued copies to[0m - [36mPath1[0m+INFO : There was nothing to transferINFO : - [36mPath1[0m [35mDo queued copies to[0m - [36mPath2[0m+INFO : There was nothing to transferINFO : Updating listingsINFO : Validating listings for Path1 "{path1/}" vs Path2 "{path2/}"INFO : [32mBisync successful[0m