| 79 | } |
| 80 | |
| 81 | func (m *MockBucketFailure) Upload(ctx context.Context, name string, r io.Reader, opts ...objstore.ObjectUploadOption) error { |
| 82 | m.UploadCalls.Add(1) |
| 83 | for prefix, err := range m.UploadFailures { |
| 84 | if strings.HasPrefix(name, prefix) { |
| 85 | return err |
| 86 | } |
| 87 | } |
| 88 | if e, ok := m.GetFailures[name]; ok { |
| 89 | return e |
| 90 | } |
| 91 | |
| 92 | return m.Bucket.Upload(ctx, name, r, opts...) |
| 93 | } |
| 94 | |
| 95 | func (m *MockBucketFailure) WithExpectedErrs(expectedFunc objstore.IsOpFailureExpectedFunc) objstore.Bucket { |
| 96 | if ibkt, ok := m.Bucket.(objstore.InstrumentedBucket); ok { |