Private EtcdHelper

This commit is contained in:
Wojciech Tyczynski
2015-07-24 13:09:49 +02:00
parent 5bd82ffe6d
commit 9d943df397
56 changed files with 471 additions and 482 deletions

View File

@@ -37,7 +37,7 @@ type REST struct {
var controllerPrefix = "/controllers"
// NewREST returns a RESTStorage object that will work against replication controllers.
func NewREST(h tools.EtcdHelper) *REST {
func NewREST(s tools.StorageInterface) *REST {
store := &etcdgeneric.Etcd{
NewFunc: func() runtime.Object { return &api.ReplicationController{} },
@@ -69,7 +69,7 @@ func NewREST(h tools.EtcdHelper) *REST {
// Used to validate controller updates
UpdateStrategy: controller.Strategy,
Helper: h,
Storage: s,
}
return &REST{store}

View File

@@ -40,17 +40,17 @@ const (
FAIL
)
func newHelper(t *testing.T) (*tools.FakeEtcdClient, tools.EtcdHelper) {
func newEtcdStorage(t *testing.T) (*tools.FakeEtcdClient, tools.StorageInterface) {
fakeEtcdClient := tools.NewFakeEtcdClient(t)
fakeEtcdClient.TestIndex = true
helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix())
return fakeEtcdClient, helper
etcdStorage := tools.NewEtcdStorage(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix())
return fakeEtcdClient, etcdStorage
}
// newStorage creates a REST storage backed by etcd helpers
func newStorage(t *testing.T) (*REST, *tools.FakeEtcdClient) {
fakeEtcdClient, h := newHelper(t)
storage := NewREST(h)
fakeEtcdClient, s := newEtcdStorage(t)
storage := NewREST(s)
return storage, fakeEtcdClient
}