mirror of
https://github.com/kubernetes/sample-controller.git
synced 2025-02-20 23:56:23 +08:00
Regenerating code of fake clientset
Kubernetes-commit: 6f381ab2cd351c96a28b7ccde704ea96c38612dd
This commit is contained in:
parent
f1e5514ccc
commit
bf54256d6b
@ -41,7 +41,15 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset {
|
||||
|
||||
fakePtr := testing.Fake{}
|
||||
fakePtr.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||
fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil))
|
||||
fakePtr.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
||||
gvr := action.GetResource()
|
||||
ns := action.GetNamespace()
|
||||
watch, err := o.Watch(gvr, ns)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
return true, watch, nil
|
||||
})
|
||||
|
||||
return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user