Skip to content

Commit 5b08b43

Browse files
committed
Add and fix tests to match improved update merging
1 parent 9f09075 commit 5b08b43

File tree

1 file changed

+66
-2
lines changed

1 file changed

+66
-2
lines changed

merge/multiple_appliers_test.go

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,8 +1304,19 @@ func TestMultipleAppliersRealConversion(t *testing.T) {
13041304
),
13051305
},
13061306
},
1307-
"applier_updater_shared_ownership_real_conversion": {
1307+
"appliers_remove_from_controller_real_conversion": {
1308+
// Ensures that an applier can delete associative map items it created after a controller
1309+
// modifies them.
13081310
Ops: []Operation{
1311+
Apply{
1312+
Manager: "apply",
1313+
Object: `
1314+
mapOfMapsRecursive:
1315+
aaa:
1316+
bbb:
1317+
`,
1318+
APIVersion: "v3",
1319+
},
13091320
Update{
13101321
Manager: "controller",
13111322
Object: `
@@ -1337,6 +1348,59 @@ func TestMultipleAppliersRealConversion(t *testing.T) {
13371348
APIVersion: "v3",
13381349
},
13391350
},
1351+
Object: `
1352+
mapOfMapsRecursive:
1353+
aaa:
1354+
ccc:
1355+
`,
1356+
APIVersion: "v3",
1357+
Managed: fieldpath.ManagedFields{
1358+
"apply": fieldpath.NewVersionedSet(
1359+
_NS(
1360+
_P("mapOfMapsRecursive", "aaa"),
1361+
_P("mapOfMapsRecursive", "ccc"),
1362+
),
1363+
"v3",
1364+
false,
1365+
),
1366+
},
1367+
},
1368+
"applier_updater_shared_ownership_real_conversion": {
1369+
// Ensures that when an updater creates maps that they are not deleted when
1370+
// an applier shares ownership in them and then later removes them from its applied
1371+
// configuration
1372+
Ops: []Operation{
1373+
Update{
1374+
Manager: "updater",
1375+
Object: `
1376+
mapOfMapsRecursive:
1377+
a:
1378+
b:
1379+
c:
1380+
`,
1381+
APIVersion: "v1",
1382+
},
1383+
Apply{
1384+
Manager: "apply",
1385+
Object: `
1386+
mapOfMapsRecursive:
1387+
aa:
1388+
bb:
1389+
cc:
1390+
dd:
1391+
`,
1392+
APIVersion: "v2",
1393+
},
1394+
Apply{
1395+
Manager: "apply",
1396+
Object: `
1397+
mapOfMapsRecursive:
1398+
aaa:
1399+
ccc:
1400+
`,
1401+
APIVersion: "v3",
1402+
},
1403+
},
13401404
Object: `
13411405
mapOfMapsRecursive:
13421406
aaa:
@@ -1346,7 +1410,7 @@ func TestMultipleAppliersRealConversion(t *testing.T) {
13461410
`,
13471411
APIVersion: "v3",
13481412
Managed: fieldpath.ManagedFields{
1349-
"controller": fieldpath.NewVersionedSet(
1413+
"updater": fieldpath.NewVersionedSet(
13501414
_NS(
13511415
_P("mapOfMapsRecursive"),
13521416
_P("mapOfMapsRecursive", "a"),

0 commit comments

Comments
 (0)