mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-06 19:52:42 +00:00
Preserve int64 data when patching
This commit is contained in:
@@ -474,6 +474,30 @@ runTests() {
|
||||
# Post-condition: valid-pod POD doesn't exist
|
||||
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" ''
|
||||
|
||||
### Create pod-with-precision POD
|
||||
# Pre-condition: no POD is running
|
||||
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" ''
|
||||
# Command
|
||||
kubectl create -f hack/testdata/pod-with-precision.json "${kube_flags[@]}"
|
||||
# Post-condition: valid-pod POD is running
|
||||
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" 'pod-with-precision:'
|
||||
|
||||
## Patch preserves precision
|
||||
# Command
|
||||
kubectl patch "${kube_flags[@]}" pod pod-with-precision -p='{"metadata":{"annotations":{"patchkey": "patchvalue"}}}'
|
||||
# Post-condition: pod-with-precision POD has patched annotation
|
||||
kube::test::get_object_assert 'pod pod-with-precision' "{{${annotations_field}.patchkey}}" 'patchvalue'
|
||||
# Command
|
||||
kubectl label pods pod-with-precision labelkey=labelvalue "${kube_flags[@]}"
|
||||
# Post-condition: pod-with-precision POD has label
|
||||
kube::test::get_object_assert 'pod pod-with-precision' "{{${labels_field}.labelkey}}" 'labelvalue'
|
||||
# Command
|
||||
kubectl annotate pods pod-with-precision annotatekey=annotatevalue "${kube_flags[@]}"
|
||||
# Post-condition: pod-with-precision POD has annotation
|
||||
kube::test::get_object_assert 'pod pod-with-precision' "{{${annotations_field}.annotatekey}}" 'annotatevalue'
|
||||
# Cleanup
|
||||
kubectl delete pod pod-with-precision "${kube_flags[@]}"
|
||||
|
||||
### Create valid-pod POD
|
||||
# Pre-condition: no POD exists
|
||||
create_and_use_new_namespace
|
||||
|
Reference in New Issue
Block a user