Limit the type for kubectl expose command
This commit is contained in:
@@ -132,3 +132,21 @@ kube::test::describe_resource_assert() {
|
||||
echo -n ${reset}
|
||||
return 0
|
||||
}
|
||||
|
||||
kube::test::if_has_string() {
|
||||
local message=$1
|
||||
local match=$2
|
||||
|
||||
if [[ $(echo "$message" | grep "$match") ]]; then
|
||||
echo "Successful"
|
||||
echo "message:$message"
|
||||
echo "has:$match"
|
||||
return 0
|
||||
else
|
||||
echo "FAIL!"
|
||||
echo "message:$message"
|
||||
echo "has not:$match"
|
||||
caller
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
@@ -680,6 +680,13 @@ __EOF__
|
||||
kubectl delete pod valid-pod "${kube_flags[@]}"
|
||||
kubectl delete service frontend{,-2,-3,-4,-5} "${kube_flags[@]}"
|
||||
|
||||
### Expose negative invalid resource test
|
||||
# Pre-condition: don't need
|
||||
# Command
|
||||
output_message=$(! kubectl expose nodes 127.0.0.1 2>&1 "${kube_flags[@]}")
|
||||
# Post-condition: the error message has "invalid resource" string
|
||||
kube::test::if_has_string "${output_message}" 'invalid resource'
|
||||
|
||||
### Delete replication controller with id
|
||||
# Pre-condition: frontend replication controller is running
|
||||
kube::test::get_object_assert rc "{{range.items}}{{$id_field}}:{{end}}" 'frontend:'
|
||||
|
Reference in New Issue
Block a user