fstest: add fs.ErrorCantShareDirectories for backends which can only share files

This commit is contained in:
Nick Craig-Wood 2019-07-24 16:57:56 +01:00
parent 8fdce31700
commit 5a44bafa4e
2 changed files with 23 additions and 18 deletions

View file

@ -68,6 +68,7 @@ var (
ErrorDirectoryNotEmpty = errors.New("directory not empty")
ErrorImmutableModified = errors.New("immutable file modified")
ErrorPermissionDenied = errors.New("permission denied")
ErrorCantShareDirectories = errors.New("this backend can't share directories with link")
)
// RegInfo provides information about a filesystem

View file

@ -1410,6 +1410,9 @@ func Run(t *testing.T, opt *Opt) {
// sharing directory for the first time
path := path.Dir(file2.Path)
link3, err := doPublicLink(context.Background(), path)
if err != nil && errors.Cause(err) == fs.ErrorCantShareDirectories {
t.Log("skipping directory tests as not supported on this backend")
} else {
require.NoError(t, err)
require.NotEqual(t, "", link3, "Link should not be empty")
@ -1431,6 +1434,7 @@ func Run(t *testing.T, opt *Opt) {
link4, err := subRemote.Features().PublicLink(context.Background(), "")
require.NoError(t, err, "Sharing root in a sub-remote should work")
require.NotEqual(t, "", link4, "Link should not be empty")
}
})
// TestSetTier tests SetTier and GetTier functionality