Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

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

Nick Craig-Wood85f9bd1abf9e
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 {