@@ -25,7 +25,9 @@ import (
25
25
corev1 "k8s.io/api/core/v1"
26
26
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27
27
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
28
+ "k8s.io/apimachinery/pkg/runtime"
28
29
"k8s.io/apimachinery/pkg/runtime/schema"
30
+ corev1applyconfigurations "k8s.io/client-go/applyconfigurations/core/v1"
29
31
"sigs.k8s.io/controller-runtime/pkg/client"
30
32
"sigs.k8s.io/controller-runtime/pkg/client/fake"
31
33
"sigs.k8s.io/controller-runtime/pkg/client/interceptor"
@@ -104,6 +106,7 @@ func TestWithStrictFieldValidation(t *testing.T) {
104
106
105
107
_ = wrappedClient .Create (ctx , dummyObj )
106
108
_ = wrappedClient .Update (ctx , dummyObj )
109
+ _ = wrappedClient .Apply (ctx , corev1applyconfigurations .ConfigMap ("foo" , "bar" ))
107
110
_ = wrappedClient .Patch (ctx , dummyObj , nil )
108
111
_ = wrappedClient .Status ().Create (ctx , dummyObj , dummyObj )
109
112
_ = wrappedClient .Status ().Update (ctx , dummyObj )
@@ -112,7 +115,7 @@ func TestWithStrictFieldValidation(t *testing.T) {
112
115
_ = wrappedClient .SubResource ("some-subresource" ).Update (ctx , dummyObj )
113
116
_ = wrappedClient .SubResource ("some-subresource" ).Patch (ctx , dummyObj , nil )
114
117
115
- if expectedCalls := 9 ; calls != expectedCalls {
118
+ if expectedCalls := 10 ; calls != expectedCalls {
116
119
t .Fatalf ("wrong number of calls to assertions: expected=%d; got=%d" , expectedCalls , calls )
117
120
}
118
121
}
@@ -188,6 +191,10 @@ func testFieldValidationClient(t *testing.T, expectedFieldValidation string, cal
188
191
}
189
192
return nil
190
193
},
194
+ Apply : func (ctx context.Context , client client.WithWatch , obj runtime.ApplyConfiguration , opts ... client.ApplyOption ) error {
195
+ callback ()
196
+ return nil
197
+ },
191
198
Patch : func (ctx context.Context , c client.WithWatch , obj client.Object , patch client.Patch , opts ... client.PatchOption ) error {
192
199
callback ()
193
200
out := & client.PatchOptions {}
0 commit comments