@@ -63,7 +63,7 @@ var fakeTypeConverter = func() fieldmanager.TypeConverter {
6363// TestUpdateApplyConflict tests that applying to an object, which
6464// wasn't created by apply, will give conflicts
6565func TestUpdateApplyConflict (t * testing.T ) {
66- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
66+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
6767
6868 patch := []byte (`{
6969 "apiVersion": "apps/v1",
@@ -124,7 +124,7 @@ func TestUpdateApplyConflict(t *testing.T) {
124124}
125125
126126func TestApplyStripsFields (t * testing.T ) {
127- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
127+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
128128
129129 newObj := & unstructured.Unstructured {
130130 Object : map [string ]interface {}{
@@ -156,7 +156,7 @@ func TestApplyStripsFields(t *testing.T) {
156156}
157157
158158func TestVersionCheck (t * testing.T ) {
159- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
159+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
160160
161161 appliedObj := & unstructured.Unstructured {Object : map [string ]interface {}{}}
162162 if err := yaml .Unmarshal ([]byte (`{
@@ -196,7 +196,7 @@ func TestVersionCheck(t *testing.T) {
196196 }
197197}
198198func TestVersionCheckDoesNotPanic (t * testing.T ) {
199- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
199+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
200200
201201 appliedObj := & unstructured.Unstructured {Object : map [string ]interface {}{}}
202202 if err := yaml .Unmarshal ([]byte (`{
@@ -235,7 +235,7 @@ func TestVersionCheckDoesNotPanic(t *testing.T) {
235235}
236236
237237func TestApplyDoesNotStripLabels (t * testing.T ) {
238- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ))
238+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ))
239239
240240 appliedObj := & unstructured.Unstructured {Object : map [string ]interface {}{}}
241241 if err := yaml .Unmarshal ([]byte (`{
@@ -289,7 +289,7 @@ func TestApplyNewObject(t *testing.T) {
289289
290290 for _ , test := range tests {
291291 t .Run (test .gvk .String (), func (t * testing.T ) {
292- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , test .gvk )
292+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , test .gvk )
293293
294294 appliedObj := & unstructured.Unstructured {Object : map [string ]interface {}{}}
295295 if err := yaml .Unmarshal (test .obj , & appliedObj .Object ); err != nil {
@@ -327,7 +327,7 @@ func BenchmarkNewObject(b *testing.B) {
327327 }
328328 for _ , test := range tests {
329329 b .Run (test .gvk .Kind , func (b * testing.B ) {
330- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , test .gvk )
330+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , test .gvk )
331331
332332 decoder := serializer .NewCodecFactory (scheme ).UniversalDecoder (test .gvk .GroupVersion ())
333333 newObj , err := runtime .Decode (decoder , test .obj )
@@ -540,7 +540,7 @@ func BenchmarkCompare(b *testing.B) {
540540}
541541
542542func BenchmarkRepeatedUpdate (b * testing.B ) {
543- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ))
543+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ))
544544 podBytes := getObjectBytes ("pod.yaml" )
545545
546546 var obj * corev1.Pod
@@ -579,7 +579,7 @@ func BenchmarkRepeatedUpdate(b *testing.B) {
579579}
580580
581581func TestApplyFailsWithManagedFields (t * testing.T ) {
582- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ))
582+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ))
583583
584584 appliedObj := & unstructured.Unstructured {Object : map [string ]interface {}{}}
585585 if err := yaml .Unmarshal ([]byte (`{
@@ -604,7 +604,7 @@ func TestApplyFailsWithManagedFields(t *testing.T) {
604604}
605605
606606func TestApplySuccessWithNoManagedFields (t * testing.T ) {
607- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ))
607+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ))
608608
609609 appliedObj := & unstructured.Unstructured {Object : map [string ]interface {}{}}
610610 if err := yaml .Unmarshal ([]byte (`{
@@ -627,7 +627,7 @@ func TestApplySuccessWithNoManagedFields(t *testing.T) {
627627
628628// Run an update and apply, and make sure that nothing has changed.
629629func TestNoOpChanges (t * testing.T ) {
630- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ))
630+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ))
631631
632632 obj := & unstructured.Unstructured {Object : map [string ]interface {}{}}
633633 if err := yaml .Unmarshal ([]byte (`{
@@ -678,7 +678,7 @@ func TestNoOpChanges(t *testing.T) {
678678// Tests that one can reset the managedFields by sending either an empty
679679// list
680680func TestResetManagedFieldsEmptyList (t * testing.T ) {
681- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ))
681+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ))
682682
683683 obj := & unstructured.Unstructured {Object : map [string ]interface {}{}}
684684 if err := yaml .Unmarshal ([]byte (`{
@@ -719,7 +719,7 @@ func TestResetManagedFieldsEmptyList(t *testing.T) {
719719
720720// Tests that one can reset the managedFields by sending either a list with one empty item.
721721func TestResetManagedFieldsEmptyItem (t * testing.T ) {
722- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ))
722+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ))
723723
724724 obj := & unstructured.Unstructured {Object : map [string ]interface {}{}}
725725 if err := yaml .Unmarshal ([]byte (`{
@@ -759,7 +759,7 @@ func TestResetManagedFieldsEmptyItem(t *testing.T) {
759759}
760760
761761func TestServerSideApplyWithInvalidLastApplied (t * testing.T ) {
762- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
762+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
763763
764764 // create object with client-side apply
765765 newObj := & unstructured.Unstructured {Object : map [string ]interface {}{}}
@@ -838,7 +838,7 @@ spec:
838838}
839839
840840func TestInteropForClientSideApplyAndServerSideApply (t * testing.T ) {
841- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
841+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
842842
843843 // create object with client-side apply
844844 newObj := & unstructured.Unstructured {Object : map [string ]interface {}{}}
@@ -922,7 +922,7 @@ spec:
922922}
923923
924924func TestNoTrackManagedFieldsForClientSideApply (t * testing.T ) {
925- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
925+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
926926
927927 // create object
928928 newObj := & unstructured.Unstructured {Object : map [string ]interface {}{}}
@@ -1102,7 +1102,7 @@ func getLastApplied(obj runtime.Object) (string, error) {
11021102}
11031103
11041104func TestUpdateViaSubresources (t * testing.T ) {
1105- f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ), "scale" , nil )
1105+ f := fieldmanagertest .NewTestFieldManagerSubresource (fakeTypeConverter , schema .FromAPIVersionAndKind ("v1" , "Pod" ), "scale" )
11061106
11071107 obj := & unstructured.Unstructured {Object : map [string ]interface {}{}}
11081108 if err := yaml .Unmarshal ([]byte (`{
@@ -1157,7 +1157,7 @@ func TestUpdateViaSubresources(t *testing.T) {
11571157// Ensures that a no-op Apply does not mutate managed fields
11581158func TestApplyDoesNotChangeManagedFields (t * testing.T ) {
11591159 originalManagedFields := []metav1.ManagedFieldsEntry {}
1160- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter ,
1160+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter ,
11611161 schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
11621162 newObj := & unstructured.Unstructured {
11631163 Object : map [string ]interface {}{},
@@ -1251,7 +1251,7 @@ func TestApplyDoesNotChangeManagedFields(t *testing.T) {
12511251// Ensures that a no-op Update does not mutate managed fields
12521252func TestUpdateDoesNotChangeManagedFields (t * testing.T ) {
12531253 originalManagedFields := []metav1.ManagedFieldsEntry {}
1254- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter ,
1254+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter ,
12551255 schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
12561256 newObj := & unstructured.Unstructured {
12571257 Object : map [string ]interface {}{},
@@ -1323,7 +1323,7 @@ func TestUpdateDoesNotChangeManagedFields(t *testing.T) {
13231323// This test makes sure that the liveObject during a patch does not mutate
13241324// its managed fields.
13251325func TestLiveObjectManagedFieldsNotRemoved (t * testing.T ) {
1326- f := fieldmanagertest .NewDefaultTestFieldManager (fakeTypeConverter ,
1326+ f := fieldmanagertest .NewTestFieldManager (fakeTypeConverter ,
13271327 schema .FromAPIVersionAndKind ("apps/v1" , "Deployment" ))
13281328 newObj := & unstructured.Unstructured {
13291329 Object : map [string ]interface {}{},
0 commit comments