mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
Add Tracker() function to fake dynamic client
This commit is contained in:
parent
35061acc28
commit
4c4c78fd39
@ -83,7 +83,7 @@ func NewSimpleDynamicClientWithCustomListKinds(scheme *runtime.Scheme, gvrToList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cs := &FakeDynamicClient{scheme: scheme, gvrToListKind: completeGVRToListKind}
|
cs := &FakeDynamicClient{scheme: scheme, gvrToListKind: completeGVRToListKind, tracker: o}
|
||||||
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
cs.AddReactor("*", "*", testing.ObjectReaction(o))
|
||||||
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
|
||||||
gvr := action.GetResource()
|
gvr := action.GetResource()
|
||||||
@ -105,6 +105,7 @@ type FakeDynamicClient struct {
|
|||||||
testing.Fake
|
testing.Fake
|
||||||
scheme *runtime.Scheme
|
scheme *runtime.Scheme
|
||||||
gvrToListKind map[schema.GroupVersionResource]string
|
gvrToListKind map[schema.GroupVersionResource]string
|
||||||
|
tracker testing.ObjectTracker
|
||||||
}
|
}
|
||||||
|
|
||||||
type dynamicResourceClient struct {
|
type dynamicResourceClient struct {
|
||||||
@ -114,6 +115,10 @@ type dynamicResourceClient struct {
|
|||||||
listKind string
|
listKind string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *FakeDynamicClient) Tracker() testing.ObjectTracker {
|
||||||
|
return c.tracker
|
||||||
|
}
|
||||||
|
|
||||||
var _ dynamic.Interface = &FakeDynamicClient{}
|
var _ dynamic.Interface = &FakeDynamicClient{}
|
||||||
|
|
||||||
func (c *FakeDynamicClient) Resource(resource schema.GroupVersionResource) dynamic.NamespaceableResourceInterface {
|
func (c *FakeDynamicClient) Resource(resource schema.GroupVersionResource) dynamic.NamespaceableResourceInterface {
|
||||||
|
Loading…
Reference in New Issue
Block a user