Skip to content

Commit e5e6a4b

Browse files
authored
sync: fix error propagation in tests (rclone#9025)
This commit fixes the sync transform test IO errors by resetting the error flag which stops subsequent tests failing.
1 parent df18e8c commit e5e6a4b

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

fs/sync/sync_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,6 +1301,7 @@ func TestSyncAfterRemovingAFileAndAddingAFileSubDirWithErrors(t *testing.T) {
13011301
err := Sync(ctx, r.Fremote, r.Flocal, false)
13021302
assert.Equal(t, fs.ErrorNotDeleting, err)
13031303
testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t)
1304+
accounting.GlobalStats().ResetCounters()
13041305

13051306
r.CheckLocalListing(
13061307
t,

fs/sync/sync_transform_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
_ "github.com/rclone/rclone/backend/all"
1515
"github.com/rclone/rclone/fs"
16+
"github.com/rclone/rclone/fs/accounting"
1617
"github.com/rclone/rclone/fs/filter"
1718
"github.com/rclone/rclone/fs/operations"
1819
"github.com/rclone/rclone/fs/walk"
@@ -507,6 +508,7 @@ func TestError(t *testing.T) {
507508
err = Sync(ctx, r.Fremote, r.Flocal, true)
508509
// testLoggerVsLsf(ctx, r.Fremote, r.Flocal, operations.GetLoggerOpt(ctx).JSON, t)
509510
assert.Error(t, err)
511+
accounting.GlobalStats().ResetCounters()
510512

511513
r.CheckLocalListing(t, []fstest.Item{file1}, []string{"toe", "toe/toe"})
512514
r.CheckRemoteListing(t, []fstest.Item{file1}, []string{"toe", "toe/toe"})

0 commit comments

Comments
 (0)