File tree Expand file tree Collapse file tree 1 file changed +130
-0
lines changed Expand file tree Collapse file tree 1 file changed +130
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,18 @@ var nestedTypeParser = func() Parser {
4444 - name: mapOfMapsRecursive
4545 type:
4646 namedType: mapOfMapsRecursive
47+ - name: struct
48+ type:
49+ namedType: struct
50+ - name: struct
51+ map:
52+ fields:
53+ - name: name
54+ type:
55+ scalar: string
56+ - name: value
57+ type:
58+ scalar: number
4759- name: listOfLists
4860 list:
4961 elementType:
@@ -500,6 +512,124 @@ func TestUpdateNestedType(t *testing.T) {
500512 ),
501513 },
502514 },
515+ "struct_apply_remove_all" : {
516+ Ops : []Operation {
517+ Apply {
518+ Manager : "default" ,
519+ Object : `
520+ struct:
521+ name: a
522+ value: 1
523+ ` ,
524+ APIVersion : "v1" ,
525+ },
526+ Apply {
527+ Manager : "default" ,
528+ Object : `
529+ ` ,
530+ APIVersion : "v1" ,
531+ },
532+ },
533+ Object : `
534+ ` ,
535+ APIVersion : "v1" ,
536+ Managed : fieldpath.ManagedFields {},
537+ },
538+ "struct_apply_remove_dangling" : {
539+ Ops : []Operation {
540+ Apply {
541+ Manager : "default" ,
542+ Object : `
543+ struct:
544+ name: a
545+ ` ,
546+ APIVersion : "v1" ,
547+ },
548+ Apply {
549+ Manager : "default" ,
550+ Object : `
551+ struct:
552+ ` ,
553+ APIVersion : "v1" ,
554+ },
555+ },
556+ Object : `
557+ struct:
558+ ` ,
559+ APIVersion : "v1" ,
560+ Managed : fieldpath.ManagedFields {
561+ "default" : fieldpath .NewVersionedSet (
562+ _NS (
563+ _P ("struct" ),
564+ ),
565+ "v1" ,
566+ true ,
567+ ),
568+ },
569+ },
570+ "struct_apply_update_remove_all" : {
571+ Ops : []Operation {
572+ Apply {
573+ Manager : "default" ,
574+ Object : `
575+ struct:
576+ name: a
577+ ` ,
578+ APIVersion : "v1" ,
579+ },
580+ Update {
581+ Manager : "controller" ,
582+ Object : `
583+ struct:
584+ name: a
585+ value: 1
586+ ` ,
587+ APIVersion : "v1" ,
588+ },
589+ Apply {
590+ Manager : "default" ,
591+ Object : `
592+ ` ,
593+ APIVersion : "v1" ,
594+ },
595+ },
596+ Object : `
597+ ` ,
598+ APIVersion : "v1" ,
599+ },
600+ "struct_apply_update_dict_dangling" : {
601+ Ops : []Operation {
602+ Apply {
603+ Manager : "default" ,
604+ Object : `
605+ struct:
606+ name: a
607+ ` ,
608+ APIVersion : "v1" ,
609+ },
610+ Update {
611+ Manager : "controller" ,
612+ Object : `
613+ struct:
614+ name: a
615+ value: 1
616+ ` ,
617+ APIVersion : "v1" ,
618+ },
619+ Apply {
620+ Manager : "default" ,
621+ Object : `
622+ struct: {}
623+ ` ,
624+ APIVersion : "v1" ,
625+ },
626+ },
627+ Object : `
628+ struct:
629+ value: 1
630+ ` ,
631+ APIVersion : "v1" ,
632+ },
503633 }
504634
505635 for name , test := range tests {
You can’t perform that action at this time.
0 commit comments