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

fstests: make integration tests work with connection strings in remotes

Nick Craig-Wood12761b3058dd
diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.go
index af9c6d704..b3bbc5724 100644
--- a/fstest/fstests/fstests.go
+++ b/fstest/fstests/fstests.go
@@ -526,23 +526,33 @@ func Run(t *testing.T, opt *Opt) {
t.Run("FsName", func(t *testing.T) {
skipIfNotOk(t)
got := removeConfigID(f.Name())
- want := remoteName[:strings.LastIndex(remoteName, ":")+1]
+ var want string
if isLocalRemote {
- want = "local:"
+ want = "local"
+ } else {
+ want = remoteName[:strings.LastIndex(remoteName, ":")]
+ comma := strings.IndexRune(remoteName, ',')
+ if comma >= 0 {
+ want = want[:comma]
+ }
}
- require.Equal(t, want, got+":")
+ require.Equal(t, want, got)
})
// TestFsRoot tests the Root method
t.Run("FsRoot", func(t *testing.T) {
skipIfNotOk(t)
- name := removeConfigID(f.Name()) + ":"
- root := f.Root()
+ got := f.Root()
+ want := subRemoteName
+ colon := strings.LastIndex(want, ":")
+ if colon >= 0 {
+ want = want[colon+1:]
+ }
if isLocalRemote {
// only check last path element on local
- require.Equal(t, filepath.Base(subRemoteName), filepath.Base(root))
+ require.Equal(t, filepath.Base(subRemoteName), filepath.Base(got))
} else {
- require.Equal(t, subRemoteName, name+root)
+ require.Equal(t, want, got)
}
})