File tree Expand file tree Collapse file tree 1 file changed +82
-0
lines changed Expand file tree Collapse file tree 1 file changed +82
-0
lines changed Original file line number Diff line number Diff line change @@ -1620,6 +1620,88 @@ func (r renamingConverter) IsMissingVersionError(err error) bool {
16201620 return err == missingVersionError
16211621}
16221622
1623+ var atomicMapParser = func () Parser {
1624+ parser , err := typed .NewParser (`types:
1625+ - name: v1
1626+ map:
1627+ fields:
1628+ - name: atomicMap
1629+ type:
1630+ namedType: atomicMap
1631+ - name: atomicMap
1632+ map:
1633+ fields:
1634+ - name: field1
1635+ type:
1636+ scalar: string
1637+ - name: field2
1638+ type:
1639+ scalar: string
1640+ elementRelationship: atomic
1641+ ` )
1642+ if err != nil {
1643+ panic (err )
1644+ }
1645+ return parser
1646+ }()
1647+
1648+ func TestMultipleApplierAtomicMaps (t * testing.T ) {
1649+ tests := map [string ]TestCase {
1650+ "force" : {
1651+ Ops : []Operation {
1652+ Apply {
1653+ Manager : "apply-one" ,
1654+ APIVersion : "v1" ,
1655+ Object : `
1656+ atomicMap:
1657+ field1: a
1658+ ` ,
1659+ },
1660+ Apply {
1661+ Manager : "apply-two" ,
1662+ APIVersion : "v1" ,
1663+ Object : `
1664+ atomicMap:
1665+ field2: b
1666+ ` ,
1667+ Conflicts : merge.Conflicts {
1668+ merge.Conflict {Manager : "apply-one" , Path : _P ("atomicMap" )},
1669+ },
1670+ },
1671+ ForceApply {
1672+ Manager : "apply-two" ,
1673+ APIVersion : "v1" ,
1674+ Object : `
1675+ atomicMap:
1676+ field2: b
1677+ ` ,
1678+ },
1679+ },
1680+ Object : `
1681+ atomicMap:
1682+ field2: b
1683+ ` ,
1684+ APIVersion : "v1" ,
1685+ Managed : fieldpath.ManagedFields {
1686+ "apply-two" : fieldpath .NewVersionedSet (
1687+ _NS (
1688+ _P ("atomicMap" ),
1689+ ),
1690+ "v1" ,
1691+ false ,
1692+ ),
1693+ },
1694+ },
1695+ }
1696+ for name , test := range tests {
1697+ t .Run (name , func (t * testing.T ) {
1698+ if err := test .Test (atomicMapParser ); err != nil {
1699+ t .Fatal (err )
1700+ }
1701+ })
1702+ }
1703+ }
1704+
16231705func BenchmarkMultipleApplierRecursiveRealConversion (b * testing.B ) {
16241706 test := TestCase {
16251707 Ops : []Operation {
You can’t perform that action at this time.
0 commit comments