remove registry from testing/fixture.go; update client-gen to not use

registry in the generated clients
This commit is contained in:
Chao Xu
2017-04-29 15:43:28 -07:00
parent ca520e34a3
commit bbb94e42c1
12 changed files with 165 additions and 204 deletions

View File

@@ -67,9 +67,9 @@ func (c *FakeEvents) PatchWithEventNamespace(event *v1.Event, data []byte) (*v1.
// Search returns a list of events matching the specified object.
func (c *FakeEvents) Search(scheme *runtime.Scheme, objOrRef runtime.Object) (*v1.EventList, error) {
action := core.NewRootListAction(eventsResource, metav1.ListOptions{})
action := core.NewRootListAction(eventsResource, eventsKind, metav1.ListOptions{})
if c.ns != "" {
action = core.NewListAction(eventsResource, c.ns, metav1.ListOptions{})
action = core.NewListAction(eventsResource, eventsKind, c.ns, metav1.ListOptions{})
}
obj, err := c.Fake.Invokes(action, &v1.EventList{})
if obj == nil {

View File

@@ -67,9 +67,9 @@ func (c *FakeEvents) PatchWithEventNamespace(event *api.Event, data []byte) (*ap
// Search returns a list of events matching the specified object.
func (c *FakeEvents) Search(scheme *runtime.Scheme, objOrRef runtime.Object) (*api.EventList, error) {
action := core.NewRootListAction(eventsResource, metav1.ListOptions{})
action := core.NewRootListAction(eventsResource, eventsKind, metav1.ListOptions{})
if c.ns != "" {
action = core.NewListAction(eventsResource, c.ns, metav1.ListOptions{})
action = core.NewListAction(eventsResource, eventsKind, c.ns, metav1.ListOptions{})
}
obj, err := c.Fake.Invokes(action, &api.EventList{})
if obj == nil {

View File

@@ -19,6 +19,7 @@ package util
import (
"reflect"
"testing"
"time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
@@ -31,7 +32,6 @@ import (
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
"time"
)
type fakeClientAccessFactory struct {
@@ -52,6 +52,7 @@ func newFakeClientAccessFactory(objs []runtime.Object) *fakeClientAccessFactory
var (
podsResource = schema.GroupVersionResource{Resource: "pods"}
podsKind = schema.GroupVersionKind{Kind: "Pod"}
)
func TestLogsForObject(t *testing.T) {
@@ -82,7 +83,7 @@ func TestLogsForObject(t *testing.T) {
},
pods: []runtime.Object{testPod()},
actions: []testclient.Action{
testclient.NewListAction(podsResource, "test", metav1.ListOptions{LabelSelector: "foo=bar"}),
testclient.NewListAction(podsResource, podsKind, "test", metav1.ListOptions{LabelSelector: "foo=bar"}),
getLogsAction("test", nil),
},
},
@@ -96,7 +97,7 @@ func TestLogsForObject(t *testing.T) {
},
pods: []runtime.Object{testPod()},
actions: []testclient.Action{
testclient.NewListAction(podsResource, "test", metav1.ListOptions{LabelSelector: "foo=bar"}),
testclient.NewListAction(podsResource, podsKind, "test", metav1.ListOptions{LabelSelector: "foo=bar"}),
getLogsAction("test", nil),
},
},
@@ -110,7 +111,7 @@ func TestLogsForObject(t *testing.T) {
},
pods: []runtime.Object{testPod()},
actions: []testclient.Action{
testclient.NewListAction(podsResource, "test", metav1.ListOptions{LabelSelector: "foo=bar"}),
testclient.NewListAction(podsResource, podsKind, "test", metav1.ListOptions{LabelSelector: "foo=bar"}),
getLogsAction("test", nil),
},
},
@@ -124,7 +125,7 @@ func TestLogsForObject(t *testing.T) {
},
pods: []runtime.Object{testPod()},
actions: []testclient.Action{
testclient.NewListAction(podsResource, "test", metav1.ListOptions{LabelSelector: "foo=bar"}),
testclient.NewListAction(podsResource, podsKind, "test", metav1.ListOptions{LabelSelector: "foo=bar"}),
getLogsAction("test", nil),
},
},
@@ -138,7 +139,7 @@ func TestLogsForObject(t *testing.T) {
},
pods: []runtime.Object{testPod()},
actions: []testclient.Action{
testclient.NewListAction(podsResource, "test", metav1.ListOptions{LabelSelector: "foo=bar"}),
testclient.NewListAction(podsResource, podsKind, "test", metav1.ListOptions{LabelSelector: "foo=bar"}),
getLogsAction("test", nil),
},
},