mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 10:19:50 +00:00
test-cmd-util: fix deprecated commands test
Additionally, move the test down to ensure definition order matches run order.
This commit is contained in:
parent
c9c8d61048
commit
46cdb3966c
@ -1077,25 +1077,6 @@ run_save_config_tests() {
|
|||||||
kubectl delete rc frontend "${kube_flags[@]}"
|
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() {
|
run_kubectl_run_tests() {
|
||||||
## kubectl run should create deployments or jobs
|
## kubectl run should create deployments or jobs
|
||||||
# Pre-Condition: no Job exists
|
# Pre-Condition: no Job exists
|
||||||
@ -1132,6 +1113,23 @@ run_kubectl_run_tests() {
|
|||||||
kubectl delete deployment nginx-apps "${kube_flags[@]}"
|
kubectl delete deployment nginx-apps "${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 2>&1 run-container pi --generator=job/v1 "--image=$IMAGE_PERL" --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(15)' "${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}}" ''
|
||||||
|
}
|
||||||
|
|
||||||
run_kubectl_get_tests() {
|
run_kubectl_get_tests() {
|
||||||
### Test retrieval of non-existing pods
|
### Test retrieval of non-existing pods
|
||||||
# Pre-condition: no POD exists
|
# Pre-condition: no POD exists
|
||||||
|
Loading…
Reference in New Issue
Block a user