Test controller's synchronize method. Requires fake etcd client to be relocated.

This commit is contained in:
Daniel Smith
2014-06-17 17:38:06 -07:00
parent b6a260940c
commit 7e464aa55c
6 changed files with 94 additions and 21 deletions

View File

@@ -22,6 +22,18 @@ import (
"github.com/coreos/go-etcd/etcd"
)
// EtcdClient is an injectable interface for testing.
type EtcdClient interface {
AddChild(key, data string, ttl uint64) (*etcd.Response, error)
Get(key string, sort, recursive bool) (*etcd.Response, error)
Set(key, value string, ttl uint64) (*etcd.Response, error)
Create(key, value string, ttl uint64) (*etcd.Response, error)
Delete(key string, recursive bool) (*etcd.Response, error)
// I'd like to use directional channels here (e.g. <-chan) but this interface mimics
// the etcd client interface which doesn't, and it doesn't seem worth it to wrap the api.
Watch(prefix string, waitIndex uint64, recursive bool, receiver chan *etcd.Response, stop chan bool) (*etcd.Response, error)
}
type EtcdResponseWithError struct {
R *etcd.Response
E error