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: Allow object name and fs check to be skipped

Nick Craig-Woode05ec2b77ee2
diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.go
index 5c4feb1f3..c88b2c4ce 100644
--- a/fstest/fstests/fstests.go
+++ b/fstest/fstests/fstests.go
@@ -134,11 +134,12 @@ type ExtraConfigItem struct{ Name, Key, Value string }
// Opt is options for Run
type Opt struct {
- RemoteName string
- NilObject fs.Object
- ExtraConfig []ExtraConfigItem
- // SkipBadWindowsCharacters skips unusable characters for windows if set
- SkipBadWindowsCharacters bool
+ RemoteName string
+ NilObject fs.Object
+ ExtraConfig []ExtraConfigItem
+ SkipBadWindowsCharacters bool // skips unusable characters for windows if set
+ SkipFsMatch bool // if set skip exact matching of Fs value
+
}
// Run runs the basic integration tests for a remote using the remote
@@ -815,13 +816,20 @@ func Run(t *testing.T, opt *Opt) {
skipIfNotOk(t)
obj := findObject(t, remote, file1.Path)
assert.Equal(t, file1.Path, obj.String())
- assert.Equal(t, "<nil>", opt.NilObject.String())
+ if opt.NilObject != nil {
+ assert.Equal(t, "<nil>", opt.NilObject.String())
+ }
})
// TestObjectFs tests the object can be found
t.Run("TestObjectFs", func(t *testing.T) {
skipIfNotOk(t)
obj := findObject(t, remote, file1.Path)
+ // If this is set we don't do the direct comparison of
+ // the Fs from the object as it may be different
+ if opt.SkipFsMatch {
+ return
+ }
testRemote := remote
if obj.Fs() != testRemote {
// Check to see if this wraps something else