From d915f75edf6137f72c569520ea111407ced1b435 Mon Sep 17 00:00:00 2001 From: nielash Date: Thu, 4 Sep 2025 04:45:28 -0400 Subject: [PATCH] bisync: fix chunker integration tests Before this change, TestChunkerS3: tests were failing because our use of obj.Remove (for "modtime_write_test") created an unexpected extra transfer. This is because chunker calls operations.Move for removes, which (per its function comment) is supposed to be only accounted as a check. But because S3 can Copy but not Move, the move falls back to copy and ends up getting counted as a transfer anyway. https://github.com/rclone/rclone/blob/99e8a63df2528e4fd470821095cbeb32e8a827a3/fs/operations/operations.go#L506 https://github.com/rclone/rclone/blob/99e8a63df2528e4fd470821095cbeb32e8a827a3/fs/operations/copy.go#L381 This is probably a bug that should get a more proper fix in operations. But in the meantime, we can get around it by doing our "modtime_write_test" with its own unique stats group. --- cmd/bisync/bisync_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/bisync/bisync_test.go b/cmd/bisync/bisync_test.go index 7f49b2921..0fc680e82 100644 --- a/cmd/bisync/bisync_test.go +++ b/cmd/bisync/bisync_test.go @@ -1018,6 +1018,7 @@ func (b *bisyncTest) checkPreReqs(ctx context.Context, opt *bisync.Options) (con } // test if modtimes are writeable testSetModtime := func(f fs.Fs) { + ctx := accounting.WithStatsGroup(ctx, random.String(8)) // keep stats separate in := bytes.NewBufferString("modtime_write_test") objinfo := object.NewStaticObjectInfo("modtime_write_test", initDate, int64(len("modtime_write_test")), true, nil, nil) obj, err := f.Put(ctx, in, objinfo) @@ -1031,6 +1032,8 @@ func (b *bisyncTest) checkPreReqs(ctx context.Context, opt *bisync.Options) (con } if err == fs.ErrorCantSetModTimeWithoutDelete { // transfers stats expected to differ on this backend logReplacements = append(logReplacements, `^.*There was nothing to transfer.*$`, dropMe) + } else { + require.NoError(b.t, err) } if !f.Features().IsLocal { time.Sleep(time.Second) // avoid GoogleCloudStorage Error 429 rateLimitExceeded