Private EtcdHelper
This commit is contained in:
@@ -33,7 +33,7 @@ type REST struct {
|
||||
}
|
||||
|
||||
// NewREST returns a RESTStorage object that will work against PersistentVolumeClaim objects.
|
||||
func NewStorage(h tools.EtcdHelper) (*REST, *StatusREST) {
|
||||
func NewStorage(s tools.StorageInterface) (*REST, *StatusREST) {
|
||||
prefix := "/persistentvolumeclaims"
|
||||
store := &etcdgeneric.Etcd{
|
||||
NewFunc: func() runtime.Object { return &api.PersistentVolumeClaim{} },
|
||||
@@ -52,7 +52,7 @@ func NewStorage(h tools.EtcdHelper) (*REST, *StatusREST) {
|
||||
},
|
||||
EndpointName: "persistentvolumeclaims",
|
||||
|
||||
Helper: h,
|
||||
Storage: s,
|
||||
}
|
||||
|
||||
store.CreateStrategy = persistentvolumeclaim.Strategy
|
||||
|
@@ -38,12 +38,12 @@ type testRegistry struct {
|
||||
*registrytest.GenericRegistry
|
||||
}
|
||||
|
||||
func newStorage(t *testing.T) (*REST, *StatusREST, *tools.FakeEtcdClient, tools.EtcdHelper) {
|
||||
func newStorage(t *testing.T) (*REST, *StatusREST, *tools.FakeEtcdClient, tools.StorageInterface) {
|
||||
fakeEtcdClient := tools.NewFakeEtcdClient(t)
|
||||
fakeEtcdClient.TestIndex = true
|
||||
helper := tools.NewEtcdHelper(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix())
|
||||
storage, statusStorage := NewStorage(helper)
|
||||
return storage, statusStorage, fakeEtcdClient, helper
|
||||
etcdStorage := tools.NewEtcdStorage(fakeEtcdClient, latest.Codec, etcdtest.PathPrefix())
|
||||
storage, statusStorage := NewStorage(etcdStorage)
|
||||
return storage, statusStorage, fakeEtcdClient, etcdStorage
|
||||
}
|
||||
|
||||
func validNewPersistentVolumeClaim(name, ns string) *api.PersistentVolumeClaim {
|
||||
@@ -318,7 +318,7 @@ func TestDeletePersistentVolumeClaims(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEtcdUpdateStatus(t *testing.T) {
|
||||
storage, statusStorage, fakeClient, helper := newStorage(t)
|
||||
storage, statusStorage, fakeClient, etcdStorage := newStorage(t)
|
||||
ctx := api.NewDefaultContext()
|
||||
fakeClient.TestIndex = true
|
||||
|
||||
@@ -357,7 +357,7 @@ func TestEtcdUpdateStatus(t *testing.T) {
|
||||
}
|
||||
var pvcOut api.PersistentVolumeClaim
|
||||
key, _ = storage.KeyFunc(ctx, "foo")
|
||||
if err := helper.ExtractObj(key, &pvcOut, false); err != nil {
|
||||
if err := etcdStorage.ExtractObj(key, &pvcOut, false); err != nil {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
if !api.Semantic.DeepEqual(expected, pvcOut) {
|
||||
|
Reference in New Issue
Block a user