@@ -32,12 +32,15 @@ import (
3232 "k8s.io/apimachinery/pkg/util/managedfields"
3333 "k8s.io/apimachinery/pkg/util/sets"
3434 "k8s.io/apimachinery/pkg/util/validation/field"
35+ "k8s.io/apimachinery/pkg/watch"
3536 "k8s.io/client-go/testing"
3637 "sigs.k8s.io/controller-runtime/pkg/client/apiutil"
3738)
3839
40+ var _ testing.ObjectTracker = (* versionedTracker )(nil )
41+
3942type versionedTracker struct {
40- testing.ObjectTracker
43+ upstream testing.ObjectTracker
4144 scheme * runtime.Scheme
4245 withStatusSubresource sets.Set [schema.GroupVersionKind ]
4346 usesFieldManagedObjectTracker bool
@@ -84,7 +87,7 @@ func (t versionedTracker) Add(obj runtime.Object) error {
8487 return fmt .Errorf ("invalid managedFields on %T: %w" , obj , err )
8588 }
8689 }
87- if err := t .Add (obj ); err != nil {
90+ if err := t .upstream . Add (obj ); err != nil {
8891 return err
8992 }
9093 }
@@ -112,7 +115,7 @@ func (t versionedTracker) Create(gvr schema.GroupVersionResource, obj runtime.Ob
112115 if err != nil {
113116 return err
114117 }
115- if err := t .Create (gvr , obj , ns , opts ... ); err != nil {
118+ if err := t .upstream . Create (gvr , obj , ns , opts ... ); err != nil {
116119 accessor .SetResourceVersion ("" )
117120 return err
118121 }
@@ -146,7 +149,7 @@ func (t versionedTracker) update(gvr schema.GroupVersionResource, obj runtime.Ob
146149 u .SetGroupVersionKind (gvk )
147150 }
148151
149- return t .Update (gvr , obj , ns , opts )
152+ return t .upstream . Update (gvr , obj , ns , opts )
150153}
151154
152155func (t versionedTracker ) Patch (gvr schema.GroupVersionResource , obj runtime.Object , ns string , opts ... metav1.PatchOptions ) error {
@@ -167,7 +170,7 @@ func (t versionedTracker) Patch(gvr schema.GroupVersionResource, obj runtime.Obj
167170 return nil
168171 }
169172
170- return t .Patch (gvr , obj , ns , patchOptions )
173+ return t .upstream . Patch (gvr , obj , ns , patchOptions )
171174}
172175
173176func (t versionedTracker ) updateObject (gvr schema.GroupVersionResource , obj runtime.Object , ns string , isStatus , deleting bool , dryRun []string ) (runtime.Object , error ) {
@@ -264,3 +267,23 @@ func (t versionedTracker) updateObject(gvr schema.GroupVersionResource, obj runt
264267 }
265268 return convertFromUnstructuredIfNecessary (t .scheme , obj )
266269}
270+
271+ func (t versionedTracker ) Apply (gvr schema.GroupVersionResource , applyConfiguration runtime.Object , ns string , opts ... metav1.PatchOptions ) error {
272+ return t .upstream .Apply (gvr , applyConfiguration , ns , opts ... )
273+ }
274+
275+ func (t versionedTracker ) Delete (gvr schema.GroupVersionResource , ns , name string , opts ... metav1.DeleteOptions ) error {
276+ return t .upstream .Delete (gvr , ns , name , opts ... )
277+ }
278+
279+ func (t versionedTracker ) Get (gvr schema.GroupVersionResource , ns , name string , opts ... metav1.GetOptions ) (runtime.Object , error ) {
280+ return t .upstream .Get (gvr , ns , name , opts ... )
281+ }
282+
283+ func (t versionedTracker ) List (gvr schema.GroupVersionResource , gvk schema.GroupVersionKind , ns string , opts ... metav1.ListOptions ) (runtime.Object , error ) {
284+ return t .upstream .List (gvr , gvk , ns , opts ... )
285+ }
286+
287+ func (t versionedTracker ) Watch (gvr schema.GroupVersionResource , ns string , opts ... metav1.ListOptions ) (watch.Interface , error ) {
288+ return t .upstream .Watch (gvr , ns , opts ... )
289+ }
0 commit comments