Skip to content

Commit

Permalink
Add Tracker() function to fake dynamic client
Browse files Browse the repository at this point in the history
  • Loading branch information
markusthoemmes committed Mar 10, 2021
1 parent 35061ac commit 4c4c78f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion staging/src/k8s.io/client-go/dynamic/fake/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -105,6 +105,7 @@ type FakeDynamicClient struct {
testing.Fake
scheme *runtime.Scheme
gvrToListKind map[schema.GroupVersionResource]string
tracker testing.ObjectTracker
}

type dynamicResourceClient struct {
Expand All @@ -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 {
Expand Down

0 comments on commit 4c4c78f

Please sign in to comment.