Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

sync: fix tests for overlapping with filter

Nick Craig-Woodcfe0911e0d9f
diff --git a/fs/operations/operations_test.go b/fs/operations/operations_test.go
index 83df26398..10475562a 100644
--- a/fs/operations/operations_test.go
+++ b/fs/operations/operations_test.go
@@ -1284,6 +1284,7 @@ func TestOverlappingFilterCheckWithoutFilter(t *testing.T) {
expected bool
}{
{"name", "root", true},
+ {"name", "/root", true},
{"namey", "root", false},
{"name", "rooty", false},
{"namey", "rooty", false},
@@ -1320,10 +1321,12 @@ func TestOverlappingFilterCheckWithFilter(t *testing.T) {
expected bool
}{
{"name", "root", true},
+ {"name", "/root", true},
{"name", "root/", true},
{"name", "root" + slash, true},
{"name", "root/exclude", false},
{"name", "root/exclude/", false},
+ {"name", "/root/exclude/", false},
{"name", "root" + slash + "exclude", false},
{"name", "root" + slash + "exclude" + slash, false},
{"name", "root/.ignore", false},
diff --git a/fs/sync/sync_test.go b/fs/sync/sync_test.go
index 19e225fd9..4bf60c471 100644
--- a/fs/sync/sync_test.go
+++ b/fs/sync/sync_test.go
@@ -1469,18 +1469,20 @@ func TestSyncOverlapWithFilter(t *testing.T) {
FremoteSync3, err := fs.NewFs(ctx, subRemoteName3)
require.NoError(t, FremoteSync3.Mkdir(ctx, ""))
require.NoError(t, err)
- r.WriteObject(context.Background(), "/rclone-sync-test-ignore-file/.ignore", "-", t1)
+ r.WriteObject(context.Background(), "rclone-sync-test-ignore-file/.ignore", "-", t1)
checkErr := func(err error) {
require.Error(t, err)
assert.True(t, fserrors.IsFatalError(err))
assert.Equal(t, fs.ErrorOverlapping.Error(), err.Error())
+ accounting.GlobalStats().ResetCounters()
}
checkNoErr := func(err error) {
require.NoError(t, err)
}
+ accounting.GlobalStats().ResetCounters()
checkNoErr(Sync(ctx, FremoteSync, r.Fremote, false))
checkErr(Sync(ctx, r.Fremote, FremoteSync, false))
checkErr(Sync(ctx, r.Fremote, r.Fremote, false))