From d2916ac5c76f79e6358004de49883b91d30b8eb7 Mon Sep 17 00:00:00 2001 From: nielash Date: Mon, 1 Sep 2025 09:51:33 -0400 Subject: [PATCH] bisync: ignore expected "nothing to transfer" differences on tests The "There was nothing to transfer" log is only printed when the number of transfers is exactly 0. However, there are a variety of reasons why the transfer count would be expected to differ between backends. For example, if either side lacks hashes, the sync may in fact need to transfer, where it would otherwise skip based on hash or just update modtime. Transfer stats will also differ in the "src and dst identical but can't set mod time without deleting and re- uploading" scenario (because the re-upload is a transfer), and where --download-hash is needed (because calculating the hash requires downloading the file, which is a transfer). Before this change, these expected differences would result in erroneous test failures. This change fixes the issue by ignoring the absence of the "nothing to transfer" log where it is expected. Note that this issue did not occur before https://github.com/rclone/rclone/commit/9e200531b1490000656031c42fff4d95477e1b46 because the number of transfers was not getting reset between test steps, sometimes resulting in an artificially inflated transfers count. --- cmd/bisync/bisync_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/bisync/bisync_test.go b/cmd/bisync/bisync_test.go index 045c6173b..c5f1ece97 100644 --- a/cmd/bisync/bisync_test.go +++ b/cmd/bisync/bisync_test.go @@ -1630,6 +1630,14 @@ func (b *bisyncTest) mangleResult(dir, file string, golden bool) string { `^.*not equal on recheck.*$`, dropMe, ) } + if b.ignoreBlankHash || !b.fs1.Hashes().Contains(hash.MD5) || !b.fs2.Hashes().Contains(hash.MD5) { + // if either side lacks support for md5, need to ignore the "nothing to transfer" log, + // as sync may in fact need to transfer, where it would otherwise skip based on hash or just update modtime. + // transfer stats will also differ in fs.ErrorCantSetModTimeWithoutDelete scenario, and where --download-hash is needed. + logReplacements = append(logReplacements, + `^.*There was nothing to transfer.*$`, dropMe, + ) + } rep := logReplacements if b.testCase == "dry_run" { rep = append(rep, dryrunReplacements...)