From 7b63879af5e56b0ca2185aad15711ffbc2196b03 Mon Sep 17 00:00:00 2001 From: nielash Date: Fri, 16 Oct 2026 12:30:50 -0400 Subject: [PATCH] bisync: fix integration tests skipping the special-character cases Before this change, the pre-flight check for the `normalization` and `extended_filenames` cases uploaded its probe file to the path root, which already held the scenario's files, and compared the first entry each path listed. That entry was usually an unrelated file, so the result depended on listing order rather than on how each backend stored the probe name. On 42 of 71 backends in the 2026-10-15 nightly, the paths appeared to differ and the cases were skipped; elsewhere the check passed without examining the probe at all. The check also named `extended_char_paths`, a case renamed to `ext_paths` in 2024. The probe's uploads counted in the step's transfer stats, which removed `There was nothing to transfer` lines from the logs of the checked cases. After this change, the probe goes in a fresh subdirectory with its own stats group, and the check compares the name listed back from there. It names only `normalization` and `extended_filenames`: `ext_paths` uses none of the probe's invalid UTF-8 or emoji, and doesn't use `--fix-case`. The `normalization` and `extended_filenames` golden logs gain the lines the probe's stats had hidden. --- cmd/bisync/bisync_test.go | 26 +++++++++++++------ .../test_extended_filenames/golden/test.log | 2 ++ .../test_normalization/golden/test.log | 6 +++++ 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/cmd/bisync/bisync_test.go b/cmd/bisync/bisync_test.go index 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) (con testSetModtime(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 test const 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 separate preTest := 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-case ctxFixCase, ci := fs.AddConfig(ctx) @@ -1140,7 +1145,12 @@ func (b *bisyncTest) checkPreReqs(ctx context.Context, opt *bisync.Options) (con if 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.log index 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 Path1 INFO : - Path2 Resync is copying files to - Path1 +INFO : There was nothing to transfer INFO : - Path1 Resync is copying files to - Path2 +INFO : There was nothing to transfer INFO : Resync updating listings INFO : Validating listings for Path1 "{path1/}" vs Path2 "{path2/}" INFO : Bisync successful diff --git a/cmd/bisync/testdata/test_normalization/golden/test.log b/cmd/bisync/testdata/test_normalization/golden/test.log index 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 Path1 INFO : - Path2 Resync is copying files to - Path1 +INFO : There was nothing to transfer INFO : - Path1 Resync is copying files to - Path2 INFO : Resync updating listings INFO : Validating listings for Path1 "{path1/}" vs Path2 "{path2/}" @@ -150,6 +151,7 @@ INFO : - Path2 Queue copy to Path1 - { INFO : - Path1 Queue copy to Path2 - "{path2/}測試_Руский___ě_áñ👸🏼🧝🏾\u200d♀️💆🏿\u200d♂️🐨🤙🏼🤮🧑🏻\u200d🔧🧑\u200d🔬éö/測試_Руский___ě_áñ👸🏼🧝🏾\u200d♀️💆🏿\u200d♂️🐨🤙🏼🤮🧑🏻\u200d🔧🧑\u200d🔬éö.txt" INFO : - Path2 Queue copy to Path1 - {path1/}file1.txt INFO : - Path2 Do queued copies to - Path1 +INFO : There was nothing to transfer INFO : - Path1 Do queued copies to - Path2 INFO : Updating listings INFO : 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 Path1 INFO : - Path2 Resync is copying files to - Path1 +INFO : There was nothing to transfer INFO : - Path1 Resync is copying files to - Path2 +INFO : There was nothing to transfer INFO : Resync updating listings INFO : Validating listings for Path1 "{path1/}" vs Path2 "{path2/}" INFO : Bisync successful @@ -209,7 +213,9 @@ INFO : - Path1 Queue copy to Path2 - { INFO : - Path1 Queue copy to Path2 - "{path2/}測試_Руский___ě_áñ👸🏼🧝🏾\u200d♀️💆🏿\u200d♂️🐨🤙🏼🤮🧑🏻\u200d🔧🧑\u200d🔬éö/測試_Руский___ě_áñ👸🏼🧝🏾\u200d♀️💆🏿\u200d♂️🐨🤙🏼🤮🧑🏻\u200d🔧🧑\u200d🔬éö.txt" INFO : - Path2 Queue copy to Path1 - {path1/}file1.txt INFO : - Path2 Do queued copies to - Path1 +INFO : There was nothing to transfer INFO : - Path1 Do queued copies to - Path2 +INFO : There was nothing to transfer INFO : Updating listings INFO : Validating listings for Path1 "{path1/}" vs Path2 "{path2/}" INFO : Bisync successful