Add Tracker() function to fake dynamic client

Kubernetes-commit: 4c4c78fd398899b4349c486063be6f4935cd92ce
This commit is contained in:
Markus Thömmes
2021-03-10 14:16:51 +01:00
committed by Kubernetes Publisher
parent 4841142cdc
commit 57471dea7c

View File

@@ -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.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
gvr := action.GetResource()
@@ -105,6 +105,7 @@ type FakeDynamicClient struct {
testing.Fake
scheme *runtime.Scheme
gvrToListKind map[schema.GroupVersionResource]string
tracker testing.ObjectTracker
}
type dynamicResourceClient struct {
@@ -114,6 +115,10 @@ type dynamicResourceClient struct {
listKind string
}
func (c *FakeDynamicClient) Tracker() testing.ObjectTracker {
return c.tracker
}
var _ dynamic.Interface = &FakeDynamicClient{}
func (c *FakeDynamicClient) Resource(resource schema.GroupVersionResource) dynamic.NamespaceableResourceInterface {