fstests: Allow object name and fs check to be skipped
This commit is contained in:
parent
9e3ea3c6ac
commit
e05ec2b77e
1 changed files with 14 additions and 6 deletions
|
@ -134,11 +134,12 @@ type ExtraConfigItem struct{ Name, Key, Value string }
|
||||||
|
|
||||||
// Opt is options for Run
|
// Opt is options for Run
|
||||||
type Opt struct {
|
type Opt struct {
|
||||||
RemoteName string
|
RemoteName string
|
||||||
NilObject fs.Object
|
NilObject fs.Object
|
||||||
ExtraConfig []ExtraConfigItem
|
ExtraConfig []ExtraConfigItem
|
||||||
// SkipBadWindowsCharacters skips unusable characters for windows if set
|
SkipBadWindowsCharacters bool // skips unusable characters for windows if set
|
||||||
SkipBadWindowsCharacters bool
|
SkipFsMatch bool // if set skip exact matching of Fs value
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run runs the basic integration tests for a remote using the remote
|
// 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)
|
skipIfNotOk(t)
|
||||||
obj := findObject(t, remote, file1.Path)
|
obj := findObject(t, remote, file1.Path)
|
||||||
assert.Equal(t, file1.Path, obj.String())
|
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
|
// TestObjectFs tests the object can be found
|
||||||
t.Run("TestObjectFs", func(t *testing.T) {
|
t.Run("TestObjectFs", func(t *testing.T) {
|
||||||
skipIfNotOk(t)
|
skipIfNotOk(t)
|
||||||
obj := findObject(t, remote, file1.Path)
|
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
|
testRemote := remote
|
||||||
if obj.Fs() != testRemote {
|
if obj.Fs() != testRemote {
|
||||||
// Check to see if this wraps something else
|
// Check to see if this wraps something else
|
||||||
|
|
Loading…
Reference in a new issue