@@ -195,10 +195,10 @@ func TestReconcile(t *testing.T) {
195195 // Deploy test-cluster-1 and test-cluster-2.
196196 testClusterT1 := unstructuredTestCluster ("test-cluster-1" , t1v1beta1 .GroupVersion .WithKind ("TestCluster" ))
197197 g .Expect (unstructured .SetNestedField (testClusterT1 .Object , "foo-value" , "spec" , "foo" )).To (Succeed ())
198- g .Expect (managerT1 .GetClient ().Patch (ctx , testClusterT1 , client .Apply , fieldOwner )).To (Succeed ())
198+ g .Expect (managerT1 .GetClient ().Apply (ctx , client .ApplyConfigurationFromUnstructured ( testClusterT1 ) , fieldOwner )).To (Succeed ())
199199 testClusterT1 = unstructuredTestCluster ("test-cluster-2" , t1v1beta1 .GroupVersion .WithKind ("TestCluster" ))
200200 g .Expect (unstructured .SetNestedField (testClusterT1 .Object , "foo-value" , "spec" , "foo" )).To (Succeed ())
201- g .Expect (managerT1 .GetClient ().Patch (ctx , testClusterT1 , client .Apply , fieldOwner )).To (Succeed ())
201+ g .Expect (managerT1 .GetClient ().Apply (ctx , client .ApplyConfigurationFromUnstructured ( testClusterT1 ) , fieldOwner )).To (Succeed ())
202202 validateManagedFields (t , g , "v1beta1" , map [string ][]string {
203203 "test-cluster-1" : {"test.cluster.x-k8s.io/v1beta1" },
204204 "test-cluster-2" : {"test.cluster.x-k8s.io/v1beta1" },
@@ -226,11 +226,11 @@ func TestReconcile(t *testing.T) {
226226 // Set an additional field with a different field manager and v1beta2 apiVersion in test-cluster-2
227227 testClusterT2 := unstructuredTestCluster ("test-cluster-2" , t2v1beta2 .GroupVersion .WithKind ("TestCluster" ))
228228 g .Expect (unstructured .SetNestedField (testClusterT2 .Object , "bar-value" , "spec" , "bar" )).To (Succeed ())
229- g .Expect (managerT2 .GetClient ().Patch (ctx , testClusterT2 , client .Apply , client .FieldOwner ("different-unit-test-client" ))).To (Succeed ())
229+ g .Expect (managerT2 .GetClient ().Apply (ctx , client .ApplyConfigurationFromUnstructured ( testClusterT2 ) , client .FieldOwner ("different-unit-test-client" ))).To (Succeed ())
230230 // Deploy test-cluster-3.
231231 testClusterT2 = unstructuredTestCluster ("test-cluster-3" , t2v1beta2 .GroupVersion .WithKind ("TestCluster" ))
232232 g .Expect (unstructured .SetNestedField (testClusterT2 .Object , "foo-value" , "spec" , "foo" )).To (Succeed ())
233- g .Expect (managerT2 .GetClient ().Patch (ctx , testClusterT2 , client .Apply , fieldOwner )).To (Succeed ())
233+ g .Expect (managerT2 .GetClient ().Apply (ctx , client .ApplyConfigurationFromUnstructured ( testClusterT2 ) , fieldOwner )).To (Succeed ())
234234 // At this point we have clusters with all combinations of managedField apiVersions.
235235 validateManagedFields (t , g , "v1beta2" , map [string ][]string {
236236 "test-cluster-1" : {"test.cluster.x-k8s.io/v1beta1" },
@@ -323,7 +323,7 @@ func TestReconcile(t *testing.T) {
323323 // Try to patch the test-clusters CRs with SSA.
324324 testClusterT4 := unstructuredTestCluster (clusterName , t4v1beta2 .GroupVersion .WithKind ("TestCluster" ))
325325 g .Expect (unstructured .SetNestedField (testClusterT4 .Object , "new-foo-value" , "spec" , "foo" )).To (Succeed ())
326- err = managerT4 .GetClient ().Patch (ctx , testClusterT4 , client .Apply , fieldOwner )
326+ err = managerT4 .GetClient ().Apply (ctx , client .ApplyConfigurationFromUnstructured ( testClusterT4 ) , fieldOwner )
327327
328328 // If managedField cleanup was skipped before, the SSA patch will fail for the clusters which still have v1beta1 managedFields.
329329 if skipCRDMigrationPhases .Has (CleanupManagedFieldsPhase ) && (clusterName == "test-cluster-1" || clusterName == "test-cluster-2" ) {
0 commit comments