b2: fix integration tests after accounting changes

In 53a1a0e3ef we started returning non nil from NewObject when
an object isn't found.  This breaks the integration tests and the API
expected of a backend.

This fixes it.
This commit is contained in:
Nick Craig-Wood 2019-08-02 17:20:45 +01:00
parent d3149acc32
commit 629b7eacd8
1 changed files with 4 additions and 3 deletions

View File

@ -548,12 +548,12 @@ func (f *Fs) newObjectWithInfo(ctx context.Context, remote string, info *api.Fil
if info != nil {
err := o.decodeMetaData(info)
if err != nil {
return o, err
return nil, err
}
} else {
err := o.readMetaData(ctx) // reads info and headers, returning an error
if err != nil {
return o, err
return nil, err
}
}
return o, nil
@ -1082,7 +1082,8 @@ func (f *Fs) purge(ctx context.Context, oldOnly bool) error {
for object := range toBeDeleted {
oi, err := f.newObjectWithInfo(ctx, object.Name, object)
if err != nil {
fs.Errorf(object, "Can't create object %+v", err)
fs.Errorf(object.Name, "Can't create object %v", err)
continue
}
tr := accounting.Stats(ctx).NewCheckingTransfer(oi)
err = f.deleteByID(object.ID, object.Name)