mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Fix premature return
This commit is contained in:
parent
e3c2482959
commit
aa1d47a3c6
@ -1138,7 +1138,7 @@ func mergePatchIntoOriginal(original, patch map[string]interface{}, t reflect.Ty
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
case !foundOriginal && !foundPatch:
|
case !foundOriginal && !foundPatch:
|
||||||
return nil
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Split all items into patch items and server-only items and then enforce the order.
|
// Split all items into patch items and server-only items and then enforce the order.
|
||||||
|
@ -5966,6 +5966,75 @@ retainKeysMergingList:
|
|||||||
retainKeysMergingList:
|
retainKeysMergingList:
|
||||||
- name: bar
|
- name: bar
|
||||||
- name: foo
|
- name: foo
|
||||||
|
`),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Description: "delete and reorder in one list, reorder in another",
|
||||||
|
StrategicMergePatchRawTestCaseData: StrategicMergePatchRawTestCaseData{
|
||||||
|
Original: []byte(`
|
||||||
|
mergingList:
|
||||||
|
- name: a
|
||||||
|
value: a
|
||||||
|
- name: b
|
||||||
|
value: b
|
||||||
|
mergeItemPtr:
|
||||||
|
- name: c
|
||||||
|
value: c
|
||||||
|
- name: d
|
||||||
|
value: d
|
||||||
|
`),
|
||||||
|
Current: []byte(`
|
||||||
|
mergingList:
|
||||||
|
- name: a
|
||||||
|
value: a
|
||||||
|
- name: b
|
||||||
|
value: b
|
||||||
|
mergeItemPtr:
|
||||||
|
- name: c
|
||||||
|
value: c
|
||||||
|
- name: d
|
||||||
|
value: d
|
||||||
|
`),
|
||||||
|
Modified: []byte(`
|
||||||
|
mergingList:
|
||||||
|
- name: b
|
||||||
|
value: b
|
||||||
|
mergeItemPtr:
|
||||||
|
- name: d
|
||||||
|
value: d
|
||||||
|
- name: c
|
||||||
|
value: c
|
||||||
|
`),
|
||||||
|
TwoWay: []byte(`
|
||||||
|
$setElementOrder/mergingList:
|
||||||
|
- name: b
|
||||||
|
$setElementOrder/mergeItemPtr:
|
||||||
|
- name: d
|
||||||
|
- name: c
|
||||||
|
mergingList:
|
||||||
|
- $patch: delete
|
||||||
|
name: a
|
||||||
|
`),
|
||||||
|
ThreeWay: []byte(`
|
||||||
|
$setElementOrder/mergingList:
|
||||||
|
- name: b
|
||||||
|
$setElementOrder/mergeItemPtr:
|
||||||
|
- name: d
|
||||||
|
- name: c
|
||||||
|
mergingList:
|
||||||
|
- $patch: delete
|
||||||
|
name: a
|
||||||
|
`),
|
||||||
|
Result: []byte(`
|
||||||
|
mergingList:
|
||||||
|
- name: b
|
||||||
|
value: b
|
||||||
|
mergeItemPtr:
|
||||||
|
- name: d
|
||||||
|
value: d
|
||||||
|
- name: c
|
||||||
|
value: c
|
||||||
`),
|
`),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -5993,9 +6062,12 @@ func TestStrategicMergePatch(t *testing.T) {
|
|||||||
testThreeWayPatch(t, c)
|
testThreeWayPatch(t, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range strategicMergePatchRawTestCases {
|
// run multiple times to exercise different map traversal orders
|
||||||
testTwoWayPatchForRawTestCase(t, c)
|
for i := 0; i < 10; i++ {
|
||||||
testThreeWayPatchForRawTestCase(t, c)
|
for _, c := range strategicMergePatchRawTestCases {
|
||||||
|
testTwoWayPatchForRawTestCase(t, c)
|
||||||
|
testThreeWayPatchForRawTestCase(t, c)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user