diff --git a/internal/blobtesting/verify.go b/internal/blobtesting/verify.go index 38af10faa..a44d3a635 100644 --- a/internal/blobtesting/verify.go +++ b/internal/blobtesting/verify.go @@ -32,6 +32,10 @@ func VerifyStorage(ctx context.Context, t testingT, r blob.Storage) { AssertGetBlobNotFound(ctx, t, r, b.blk) } + if err := r.DeleteBlob(ctx, "no-such-blob"); err != nil && !errors.Is(err, blob.ErrBlobNotFound) { + t.Errorf("invalid error when deleting non-existent blob: %v", err) + } + // Now add blocks. for _, b := range blocks { if err := r.PutBlob(ctx, b.blk, gather.FromSlice(b.contents)); err != nil { diff --git a/internal/testutil/retriable_t.go b/internal/testutil/retriable_t.go index 21289b36d..0b067a91e 100644 --- a/internal/testutil/retriable_t.go +++ b/internal/testutil/retriable_t.go @@ -21,9 +21,10 @@ type RetriableT struct { failedCount int32 } -func (t *RetriableT) maybeSuppressAndSkip(cnt int32) { +func (t *RetriableT) maybeSuppressAndSkip(cnt int32, msg string) { if t.suppressErrors { atomic.AddInt32(&t.failedCount, cnt) + t.Logf("suppressing failure: %v", msg) t.SkipNow() return @@ -33,56 +34,56 @@ func (t *RetriableT) maybeSuppressAndSkip(cnt int32) { // Fail wraps testing.T.Fail(). func (t *RetriableT) Fail() { t.T.Helper() - t.maybeSuppressAndSkip(1) + t.maybeSuppressAndSkip(1, "Fail") t.T.Fail() } // FailNow wraps testing.T.FailNow(). func (t *RetriableT) FailNow() { t.T.Helper() - t.maybeSuppressAndSkip(1) + t.maybeSuppressAndSkip(1, "FailNow") t.T.FailNow() } // Error wraps testing.T.Error(). func (t *RetriableT) Error(args ...interface{}) { t.T.Helper() - t.maybeSuppressAndSkip(1) + t.maybeSuppressAndSkip(1, fmt.Sprint(args...)) t.T.Error(args...) } // Errorf wraps testing.T.Errorf(). func (t *RetriableT) Errorf(msg string, args ...interface{}) { t.T.Helper() - t.maybeSuppressAndSkip(1) + t.maybeSuppressAndSkip(1, fmt.Sprintf(msg, args...)) t.T.Errorf(msg, args...) } // Fatal wraps testing.T.Fatal(). func (t *RetriableT) Fatal(args ...interface{}) { t.T.Helper() - t.maybeSuppressAndSkip(1) + t.maybeSuppressAndSkip(1, fmt.Sprint(args...)) t.T.Fatal(args...) } // Fatalf wraps testing.T.Fatalf(). func (t *RetriableT) Fatalf(msg string, args ...interface{}) { t.T.Helper() - t.maybeSuppressAndSkip(1) + t.maybeSuppressAndSkip(1, fmt.Sprintf(msg, args...)) t.T.Fatalf(msg, args...) } // Skip wraps testing.T.Skip(). func (t *RetriableT) Skip(args ...interface{}) { t.T.Helper() - t.maybeSuppressAndSkip(0) + t.maybeSuppressAndSkip(0, fmt.Sprint(args...)) t.T.Skip(args...) } // Skipf wraps testing.T.Skipf(). func (t *RetriableT) Skipf(msg string, args ...interface{}) { t.T.Helper() - t.maybeSuppressAndSkip(0) + t.maybeSuppressAndSkip(0, fmt.Sprintf(msg, args...)) t.T.Skipf(msg, args...) } diff --git a/repo/blob/b2/b2_storage.go b/repo/blob/b2/b2_storage.go index aa20ead4b..efc8d49dd 100644 --- a/repo/blob/b2/b2_storage.go +++ b/repo/blob/b2/b2_storage.go @@ -131,7 +131,7 @@ func translateError(err error) error { return blob.ErrBlobNotFound } - if b2err.Status == http.StatusBadRequest && b2err.Code == "already_hidden" { + if b2err.Status == http.StatusBadRequest && (b2err.Code == "already_hidden" || b2err.Code == "no_such_file") { // Special case when hiding a file that is already hidden. It's basically // not found. return blob.ErrBlobNotFound