mirror of https://github.com/docker/docs.git
store: Mock stores can now be created
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
parent
b459f7c7f8
commit
f49ca7e20f
|
@ -6,15 +6,17 @@ import "github.com/stretchr/testify/mock"
|
|||
type Mock struct {
|
||||
mock.Mock
|
||||
|
||||
endpoints []string
|
||||
options *Config
|
||||
// Endpoints passed to InitializeMock
|
||||
Endpoints []string
|
||||
// Options passed to InitializeMock
|
||||
Options *Config
|
||||
}
|
||||
|
||||
// InitializeMock creates a Mock store.
|
||||
func InitializeMock(endpoints []string, options *Config) (Store, error) {
|
||||
s := &Mock{}
|
||||
s.endpoints = endpoints
|
||||
s.options = options
|
||||
s.Endpoints = endpoints
|
||||
s.Options = options
|
||||
return s, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,10 @@ import (
|
|||
type Backend string
|
||||
|
||||
const (
|
||||
// MOCK backend
|
||||
MOCK Backend = "mock"
|
||||
// CONSUL backend
|
||||
CONSUL Backend = "consul"
|
||||
CONSUL = "consul"
|
||||
// ETCD backend
|
||||
ETCD = "etcd"
|
||||
// ZK backend
|
||||
|
@ -114,6 +116,7 @@ type Initialize func(addrs []string, options *Config) (Store, error)
|
|||
var (
|
||||
// Backend initializers
|
||||
initializers = map[Backend]Initialize{
|
||||
MOCK: InitializeMock,
|
||||
CONSUL: InitializeConsul,
|
||||
ETCD: InitializeEtcd,
|
||||
ZK: InitializeZookeeper,
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
)
|
||||
|
||||
// Zookeeper embeds the zookeeper client
|
||||
// and list of watches
|
||||
type Zookeeper struct {
|
||||
timeout time.Duration
|
||||
client *zk.Conn
|
||||
|
|
Loading…
Reference in New Issue