simplify mocks

Embed the interface that we're mocking; calling any of it's methods
that are not implemented will panic, so should give the same result
as before.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 2cd52d5c0c)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2022-11-10 17:07:31 +01:00
parent f0d4c1a67d
commit 86c2280e10
4 changed files with 4 additions and 54 deletions

View File

@@ -13,10 +13,9 @@ import (
type mockTagStore struct {
mapping map[string]distribution.Descriptor
sync.Mutex
distribution.TagService
}
var _ distribution.TagService = &mockTagStore{}
func (m *mockTagStore) Get(ctx context.Context, tag string) (distribution.Descriptor, error) {
m.Lock()
defer m.Unlock()
@@ -58,10 +57,6 @@ func (m *mockTagStore) All(ctx context.Context) ([]string, error) {
return tags, nil
}
func (m *mockTagStore) Lookup(ctx context.Context, digest distribution.Descriptor) ([]string, error) {
panic("not implemented")
}
func testProxyTagService(local, remote map[string]distribution.Descriptor) *proxyTagService {
if local == nil {
local = make(map[string]distribution.Descriptor)