@@ -96,6 +96,34 @@ run_kubectl_apply_tests() {
96
96
# cleanup
97
97
kubectl delete pods selector-test-pod
98
98
99
+ # Create a deployment
100
+ kubectl apply -f hack/testdata/null-propagation/deployment-null.yml " ${kube_flags[@]:? } "
101
+ # resources.limits.cpu should be nil.
102
+ kube::test::get_object_jsonpath_assert " deployment/my-dep-null" " {.spec.template.spec.containers[0].resources.requests.cpu}" ' '
103
+ kube::test::get_object_jsonpath_assert " deployment/my-dep-null" " {.spec.template.spec.containers[0].resources.requests.memory}" ' 64Mi'
104
+ # The default value of the terminationMessagePolicy field is `File`, so the result will not be changed.
105
+ kube::test::get_object_jsonpath_assert " deployment/my-dep-null" " {.spec.template.spec.containers[0].terminationMessagePolicy}" ' File'
106
+
107
+ # kubectl apply on create should do what kubectl apply on update will accomplish.
108
+ kubectl apply -f hack/testdata/null-propagation/deployment-null.yml " ${kube_flags[@]} "
109
+ kube::test::get_object_jsonpath_assert " deployment/my-dep-null" " {.spec.template.spec.containers[0].resources.requests.cpu}" ' '
110
+ kube::test::get_object_jsonpath_assert " deployment/my-dep-null" " {.spec.template.spec.containers[0].resources.requests.memory}" ' 64Mi'
111
+ kube::test::get_object_jsonpath_assert " deployment/my-dep-null" " {.spec.template.spec.containers[0].terminationMessagePolicy}" ' File'
112
+
113
+ # hard.limits.cpu should be nil.
114
+ kubectl apply -f hack/testdata/null-propagation/resourcesquota-null.yml " ${kube_flags[@]} "
115
+ kube::test::get_object_jsonpath_assert " resourcequota/my-rq" " {.spec.hard['limits\.cpu']}" ' '
116
+ kube::test::get_object_jsonpath_assert " resourcequota/my-rq" " {.spec.hard['limits\.memory']}" ' '
117
+
118
+ # kubectl apply on create should do what kubectl apply on update will accomplish.
119
+ kubectl apply -f hack/testdata/null-propagation/resourcesquota-null.yml " ${kube_flags[@]} "
120
+ kube::test::get_object_jsonpath_assert " resourcequota/my-rq" " {.spec.hard['limits\.cpu']}" ' '
121
+ kube::test::get_object_jsonpath_assert " resourcequota/my-rq" " {.spec.hard['limits\.memory']}" ' '
122
+
123
+ # cleanup
124
+ kubectl delete deployment my-dep-null
125
+ kubectl delete resourcequota my-rq
126
+
99
127
# # kubectl apply --dry-run=server
100
128
# Pre-Condition: no POD exists
101
129
kube::test::get_object_assert pods " {{range.items}}{{${id_field:? } }}:{{end}}" ' '
0 commit comments