kubectl describe <kind> work with no arguments

Add describe_resource_assert to test describe <kind> with no object arg
This commit is contained in:
feihujiang
2015-08-04 15:12:29 +08:00
parent 2bfa9a1f98
commit 73b694e6c1
6 changed files with 66 additions and 2 deletions

View File

@@ -79,3 +79,31 @@ kube::test::describe_object_assert() {
echo -n ${reset}
return 0
}
kube::test::describe_resource_assert() {
local resource=$1
local matches=${@:2}
result=$(eval kubectl describe "${kube_flags[@]}" $resource)
for match in ${matches}; do
if [[ ! $(echo "$result" | grep ${match}) ]]; then
echo ${bold}${red}
echo "FAIL!"
echo "Describe $resource"
echo " Expected Match: $match"
echo " Not found in:"
echo "$result"
echo ${reset}${red}
caller
echo ${reset}
return 1
fi
done
echo -n ${green}
echo "Successful describe $resource:"
echo "$result"
echo -n ${reset}
return 0
}