1
mirror of https://github.com/rclone/rclone synced 2024-11-23 00:06:55 +01:00

union: fix tests by looking for fs.ErrorDirNotFound found in Purge and About

Before this change we errored out if one upstream errored in Purge or
About.

This change checks for fs.ErrorDirNotFound and skips that backend in
this case.
This commit is contained in:
Nick Craig-Wood 2020-08-19 18:04:16 +01:00
parent 63e4d2952b
commit 85f9bd1abf
2 changed files with 9 additions and 0 deletions

View File

@ -181,6 +181,9 @@ func (f *Fs) Purge(ctx context.Context, dir string) error {
errs := Errors(make([]error, len(upstreams)))
multithread(len(upstreams), func(i int) {
err := upstreams[i].Features().Purge(ctx, dir)
if errors.Cause(err) == fs.ErrorDirNotFound {
err = nil
}
errs[i] = errors.Wrap(err, upstreams[i].Name())
})
return errs.Err()
@ -504,6 +507,9 @@ func (f *Fs) About(ctx context.Context) (*fs.Usage, error) {
}
for _, u := range f.upstreams {
usg, err := u.About(ctx)
if errors.Cause(err) == fs.ErrorDirNotFound {
continue
}
if err != nil {
return nil, err
}

View File

@ -335,6 +335,9 @@ func (f *Fs) updateUsageCore(lock bool) error {
usage, err := f.RootFs.Features().About(ctx)
if err != nil {
f.cacheUpdate = false
if errors.Cause(err) == fs.ErrorDirNotFound {
err = nil
}
return err
}
if lock {