libnetwork/datastore: move MockData to a _test file

It's only used in tests, and only within this package.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-07-21 14:02:53 +02:00
parent afd4805278
commit d5b1e43b8f
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -7,9 +7,6 @@ import (
"github.com/docker/docker/libnetwork/types"
)
// ErrNotImplemented exported
var ErrNotImplemented = errors.New("Functionality not implemented")
// MockData exported
type MockData struct {
Data []byte
@ -23,8 +20,7 @@ type MockStore struct {
// NewMockStore creates a Map backed Datastore that is useful for mocking
func NewMockStore() *MockStore {
db := make(map[string]*MockData)
return &MockStore{db}
return &MockStore{db: make(map[string]*MockData)}
}
// Get the value at "key", returns the last modified index
@ -56,7 +52,7 @@ func (s *MockStore) Exists(key string) (bool, error) {
// List gets a range of values at "directory"
func (s *MockStore) List(prefix string) ([]*store.KVPair, error) {
return nil, ErrNotImplemented
return nil, errors.New("not implemented")
}
// AtomicPut put a value at "key" if the key has not been