fstests: allow skipping of the broken UTF-8 test for the cache backend

This commit is contained in:
Nick Craig-Wood 2019-10-10 10:32:28 +01:00
parent e8b92f4853
commit 6abaa9e22c
2 changed files with 5 additions and 0 deletions

View File

@ -19,5 +19,6 @@ func TestIntegration(t *testing.T) {
NilObject: (*cache.Object)(nil),
UnimplementableFsMethods: []string{"PublicLink", "MergeDirs", "OpenWriterAt"},
UnimplementableObjectMethods: []string{"MimeType", "ID", "GetTier", "SetTier"},
SkipInvalidUTF8: true, // invalid UTF-8 confuses the cache
})
}

View File

@ -260,6 +260,7 @@ type Opt struct {
UnimplementableObjectMethods []string // List of methods which can't be implemented in this wrapping Fs
SkipFsCheckWrap bool // if set skip FsCheckWrap
SkipObjectCheckWrap bool // if set skip ObjectCheckWrap
SkipInvalidUTF8 bool // if set skip invalid UTF-8 checks
}
// returns true if x is found in ss
@ -564,6 +565,9 @@ func Run(t *testing.T, opt *Opt) {
{"invalid UTF-8", "invalid utf-8\xfe"},
} {
t.Run(test.name, func(t *testing.T) {
if opt.SkipInvalidUTF8 && test.name == "invalid UTF-8" {
t.Skip("Skipping " + test.name)
}
// turn raw strings into Standard encoding
fileName := encoder.Standard.Encode(test.path)
dirName := fileName