From 85f9bd1abf9ec4ec2a187294de01bbd759183746 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 19 Aug 2020 18:04:16 +0100 Subject: [PATCH] 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. --- backend/union/union.go | 6 ++++++ backend/union/upstream/upstream.go | 3 +++ 2 files changed, 9 insertions(+) diff --git a/backend/union/union.go b/backend/union/union.go index a803a7e51..1c178d9ab 100644 --- a/backend/union/union.go +++ b/backend/union/union.go @@ -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 } diff --git a/backend/union/upstream/upstream.go b/backend/union/upstream/upstream.go index 2a58048e8..d8679a091 100644 --- a/backend/union/upstream/upstream.go +++ b/backend/union/upstream/upstream.go @@ -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 {