Limit the type for kubectl expose command

This commit is contained in:
feihujiang
2015-08-26 16:06:40 +08:00
parent 3d2816435b
commit 98689a99ec
9 changed files with 90 additions and 15 deletions

View File

@@ -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
}

View File

@@ -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:'