test-cmd-util.sh: add test for deprecated commands

This commit is contained in:
Alexander Campbell 2017-05-19 08:49:43 -07:00
parent b3fc6556e4
commit 2acc5f18b5

View File

@ -1077,6 +1077,25 @@ run_save_config_tests() {
kubectl delete rc frontend "${kube_flags[@]}"
}
run_kubectl_using_deprecated_commands_test() {
## `kubectl run-container` should function identical to `kubectl run`, but it
## should also print a deprecation warning.
# Pre-Condition: no Job exists
kube::test::get_object_assert jobs "{{range.items}}{{$id_field}}:{{end}}" ''
# Command
output_message=$(kubectl run-container pi --generator=job/v1 "--image=$IMAGE_PERL" --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(20)' "${kube_flags[@]}")
# Ensure that the user is warned their command is deprecated.
kube::test::if_has_string "${output_message}" 'Deprecated'
# Post-Condition: Job "pi" is created
kube::test::get_object_assert jobs "{{range.items}}{{$id_field}}:{{end}}" 'pi:'
# Clean up
kubectl delete jobs pi "${kube_flags[@]}"
# Post-condition: no pods exist.
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" ''
# Clean up
kubectl delete deployment nginx-apps "${kube_flags[@]}"
}
run_kubectl_run_tests() {
## kubectl run should create deployments or jobs
# Pre-Condition: no Job exists
@ -3140,6 +3159,7 @@ runTests() {
# run for federation apiserver as well.
run_kubectl_apply_tests
run_kubectl_run_tests
run_kubectl_using_deprecated_commands_test
run_kubectl_create_filter_tests
fi