Skip to content

Commit 43c19bb

Browse files
authored
Merge pull request #166 from jpbetz/remove-unowned-fields
Remove fields that are omitted from applied configurations if there are no other owners
2 parents 068223b + 5b08b43 commit 43c19bb

File tree

5 files changed

+635
-23
lines changed

5 files changed

+635
-23
lines changed

merge/leaf_test.go

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ func TestUpdateLeaf(t *testing.T) {
345345
),
346346
},
347347
},
348-
"apply_twice_dangling": {
348+
"apply_twice_remove": {
349349
Ops: []Operation{
350350
Apply{
351351
Manager: "default",
@@ -365,9 +365,7 @@ func TestUpdateLeaf(t *testing.T) {
365365
},
366366
},
367367
Object: `
368-
numeric: 1
369368
string: "new string"
370-
bool: false
371369
`,
372370
APIVersion: "v1",
373371
Managed: fieldpath.ManagedFields{
@@ -380,7 +378,43 @@ func TestUpdateLeaf(t *testing.T) {
380378
),
381379
},
382380
},
383-
"apply_twice_dangling_different_version": {
381+
"update_apply_omits": {
382+
Ops: []Operation{
383+
Apply{
384+
Manager: "default",
385+
APIVersion: "v1",
386+
Object: `
387+
numeric: 2
388+
`,
389+
},
390+
Update{
391+
Manager: "controller",
392+
APIVersion: "v1",
393+
Object: `
394+
numeric: 1
395+
`,
396+
},
397+
Apply{
398+
Manager: "default",
399+
APIVersion: "v1",
400+
Object: ``,
401+
},
402+
},
403+
Object: `
404+
numeric: 1
405+
`,
406+
APIVersion: "v1",
407+
Managed: fieldpath.ManagedFields{
408+
"controller": fieldpath.NewVersionedSet(
409+
_NS(
410+
_P("numeric"),
411+
),
412+
"v1",
413+
false,
414+
),
415+
},
416+
},
417+
"apply_twice_remove_different_version": {
384418
Ops: []Operation{
385419
Apply{
386420
Manager: "default",
@@ -400,9 +434,7 @@ func TestUpdateLeaf(t *testing.T) {
400434
},
401435
},
402436
Object: `
403-
numeric: 1
404437
string: "new string"
405-
bool: false
406438
`,
407439
APIVersion: "v1",
408440
Managed: fieldpath.ManagedFields{
@@ -462,7 +494,6 @@ func TestUpdateLeaf(t *testing.T) {
462494
},
463495
},
464496
Object: `
465-
string: "string"
466497
`,
467498
APIVersion: "v1",
468499
Managed: fieldpath.ManagedFields{},

0 commit comments

Comments
 (0)