mirror of
https://github.com/kubernetes/client-go.git
synced 2025-09-13 13:52:01 +00:00
Refactor scheduler factory test
Use `k8s.io/client-go/kubernetes/fake.Clientset` as the fake k8s client. Signed-off-by: He Xiaoxi <xxhe@alauda.io> Kubernetes-commit: a96a390d924d33ba7dda13761ff0eb1eb37a02b6
This commit is contained in:
committed by
Kubernetes Publisher
parent
7571b2924a
commit
da56c29d61
@@ -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{})
|
||||
|
Reference in New Issue
Block a user