Skip to content

Commit 280b493

Browse files
committed
fix race in test with mockRepo/mockBlobStore
use pointer receivers in mockRepo and mockBlobStore to avoid copying the mutex in mockBlobStore Signed-off-by: Joe Lanford <[email protected]>
1 parent 68c1758 commit 280b493

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

pkg/image/registry_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -233,19 +233,19 @@ func (f *mockRepo) init(ctx context.Context, base distribution.Repository, optio
233233
return f, nil
234234
}
235235

236-
func (f mockRepo) Named() reference.Named {
236+
func (f *mockRepo) Named() reference.Named {
237237
return f.base.Named()
238238
}
239239

240-
func (f mockRepo) Manifests(ctx context.Context, options ...distribution.ManifestServiceOption) (distribution.ManifestService, error) {
240+
func (f *mockRepo) Manifests(ctx context.Context, options ...distribution.ManifestServiceOption) (distribution.ManifestService, error) {
241241
return f.base.Manifests(ctx, options...)
242242
}
243243

244-
func (f mockRepo) Blobs(ctx context.Context) distribution.BlobStore {
244+
func (f *mockRepo) Blobs(ctx context.Context) distribution.BlobStore {
245245
return f.blobStore
246246
}
247247

248-
func (f mockRepo) Tags(ctx context.Context) distribution.TagService {
248+
func (f *mockRepo) Tags(ctx context.Context) distribution.TagService {
249249
return f.base.Tags(ctx)
250250
}
251251

@@ -270,30 +270,30 @@ func (f *mockBlobStore) Stat(ctx context.Context, dgst digest.Digest) (distribut
270270
return f.base.Stat(ctx, dgst)
271271
}
272272

273-
func (f mockBlobStore) Get(ctx context.Context, dgst digest.Digest) ([]byte, error) {
273+
func (f *mockBlobStore) Get(ctx context.Context, dgst digest.Digest) ([]byte, error) {
274274
return f.base.Get(ctx, dgst)
275275
}
276276

277-
func (f mockBlobStore) Open(ctx context.Context, dgst digest.Digest) (distribution.ReadSeekCloser, error) {
277+
func (f *mockBlobStore) Open(ctx context.Context, dgst digest.Digest) (distribution.ReadSeekCloser, error) {
278278
return f.base.Open(ctx, dgst)
279279
}
280280

281-
func (f mockBlobStore) Put(ctx context.Context, mediaType string, p []byte) (distribution.Descriptor, error) {
281+
func (f *mockBlobStore) Put(ctx context.Context, mediaType string, p []byte) (distribution.Descriptor, error) {
282282
return f.base.Put(ctx, mediaType, p)
283283
}
284284

285-
func (f mockBlobStore) Create(ctx context.Context, options ...distribution.BlobCreateOption) (distribution.BlobWriter, error) {
285+
func (f *mockBlobStore) Create(ctx context.Context, options ...distribution.BlobCreateOption) (distribution.BlobWriter, error) {
286286
return f.base.Create(ctx, options...)
287287
}
288288

289-
func (f mockBlobStore) Resume(ctx context.Context, id string) (distribution.BlobWriter, error) {
289+
func (f *mockBlobStore) Resume(ctx context.Context, id string) (distribution.BlobWriter, error) {
290290
return f.base.Resume(ctx, id)
291291
}
292292

293-
func (f mockBlobStore) ServeBlob(ctx context.Context, w http.ResponseWriter, r *http.Request, dgst digest.Digest) error {
293+
func (f *mockBlobStore) ServeBlob(ctx context.Context, w http.ResponseWriter, r *http.Request, dgst digest.Digest) error {
294294
return f.base.ServeBlob(ctx, w, r, dgst)
295295
}
296296

297-
func (f mockBlobStore) Delete(ctx context.Context, dgst digest.Digest) error {
297+
func (f *mockBlobStore) Delete(ctx context.Context, dgst digest.Digest) error {
298298
return f.base.Delete(ctx, dgst)
299299
}

0 commit comments

Comments
 (0)