From da56c29d61e9015fe9240c112ca369793e4c4004 Mon Sep 17 00:00:00 2001 From: He Xiaoxi Date: Tue, 2 Oct 2018 23:46:17 +0800 Subject: [PATCH] Refactor scheduler factory test Use `k8s.io/client-go/kubernetes/fake.Clientset` as the fake k8s client. Signed-off-by: He Xiaoxi Kubernetes-commit: a96a390d924d33ba7dda13761ff0eb1eb37a02b6 --- .../typed/core/v1/fake/fake_pod_expansion.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/kubernetes/typed/core/v1/fake/fake_pod_expansion.go b/kubernetes/typed/core/v1/fake/fake_pod_expansion.go index 497cc785..9c4b09d3 100644 --- a/kubernetes/typed/core/v1/fake/fake_pod_expansion.go +++ b/kubernetes/typed/core/v1/fake/fake_pod_expansion.go @@ -26,20 +26,31 @@ import ( func (c *FakePods) Bind(binding *v1.Binding) error { action := core.CreateActionImpl{} action.Verb = "create" + action.Namespace = binding.Namespace action.Resource = podsResource - action.Subresource = "bindings" + action.Subresource = "binding" action.Object = binding _, err := c.Fake.Invokes(action, binding) return err } +func (c *FakePods) GetBinding(name string) (result *v1.Binding, err error) { + obj, err := c.Fake. + Invokes(core.NewGetSubresourceAction(podsResource, c.ns, "binding", name), &v1.Binding{}) + + if obj == nil { + return nil, err + } + return obj.(*v1.Binding), err +} + func (c *FakePods) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request { action := core.GenericActionImpl{} action.Verb = "get" action.Namespace = c.ns action.Resource = podsResource - action.Subresource = "logs" + action.Subresource = "log" action.Value = opts _, _ = c.Fake.Invokes(action, &v1.Pod{})