@@ -16,12 +16,15 @@ import (
1616 "k8s.io/apimachinery/pkg/util/managedfields"
1717 "k8s.io/apimachinery/pkg/util/sets"
1818 "k8s.io/apimachinery/pkg/util/validation/field"
19+ "k8s.io/apimachinery/pkg/watch"
1920 "k8s.io/client-go/testing"
2021 "sigs.k8s.io/controller-runtime/pkg/client/apiutil"
2122)
2223
24+ var _ testing.ObjectTracker = (* versionedTracker )(nil )
25+
2326type versionedTracker struct {
24- testing.ObjectTracker
27+ upstream testing.ObjectTracker
2528 scheme * runtime.Scheme
2629 withStatusSubresource sets.Set [schema.GroupVersionKind ]
2730 usesFieldManagedObjectTracker bool
@@ -68,7 +71,7 @@ func (t versionedTracker) Add(obj runtime.Object) error {
6871 return fmt .Errorf ("invalid managedFields on %T: %w" , obj , err )
6972 }
7073 }
71- if err := t .Add (obj ); err != nil {
74+ if err := t .upstream . Add (obj ); err != nil {
7275 return err
7376 }
7477 }
@@ -96,7 +99,7 @@ func (t versionedTracker) Create(gvr schema.GroupVersionResource, obj runtime.Ob
9699 if err != nil {
97100 return err
98101 }
99- if err := t .Create (gvr , obj , ns , opts ... ); err != nil {
102+ if err := t .upstream . Create (gvr , obj , ns , opts ... ); err != nil {
100103 accessor .SetResourceVersion ("" )
101104 return err
102105 }
@@ -130,7 +133,7 @@ func (t versionedTracker) update(gvr schema.GroupVersionResource, obj runtime.Ob
130133 u .SetGroupVersionKind (gvk )
131134 }
132135
133- return t .Update (gvr , obj , ns , opts )
136+ return t .upstream . Update (gvr , obj , ns , opts )
134137}
135138
136139func (t versionedTracker ) Patch (gvr schema.GroupVersionResource , obj runtime.Object , ns string , opts ... metav1.PatchOptions ) error {
@@ -151,7 +154,7 @@ func (t versionedTracker) Patch(gvr schema.GroupVersionResource, obj runtime.Obj
151154 return nil
152155 }
153156
154- return t .Patch (gvr , obj , ns , patchOptions )
157+ return t .upstream . Patch (gvr , obj , ns , patchOptions )
155158}
156159
157160func (t versionedTracker ) updateObject (gvr schema.GroupVersionResource , obj runtime.Object , ns string , isStatus , deleting bool , dryRun []string ) (runtime.Object , error ) {
@@ -248,3 +251,20 @@ func (t versionedTracker) updateObject(gvr schema.GroupVersionResource, obj runt
248251 }
249252 return convertFromUnstructuredIfNecessary (t .scheme , obj )
250253}
254+ func (t versionedTracker ) Apply (gvr schema.GroupVersionResource , applyConfiguration runtime.Object , ns string , opts ... metav1.PatchOptions ) error {
255+ return t .upstream .Apply (gvr , applyConfiguration , ns , opts ... )
256+ }
257+ func (t versionedTracker ) Delete (gvr schema.GroupVersionResource , ns , name string , opts ... metav1.DeleteOptions ) error {
258+ return t .upstream .Delete (gvr , ns , name , opts ... )
259+ }
260+
261+ func (t versionedTracker ) Get (gvr schema.GroupVersionResource , ns , name string , opts ... metav1.GetOptions ) (runtime.Object , error ) {
262+ return t .upstream .Get (gvr , ns , name , opts ... )
263+ }
264+
265+ func (t versionedTracker ) List (gvr schema.GroupVersionResource , gvk schema.GroupVersionKind , ns string , opts ... metav1.ListOptions ) (runtime.Object , error ) {
266+ return t .upstream .List (gvr , gvk , ns , opts ... )
267+ }
268+ func (t versionedTracker ) Watch (gvr schema.GroupVersionResource , ns string , opts ... metav1.ListOptions ) (watch.Interface , error ) {
269+ return t .upstream .Watch (gvr , ns , opts ... )
270+ }
0 commit comments