mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-03 18:27:49 +00:00
kubectl describe <kind> work with no arguments
Add describe_resource_assert to test describe <kind> with no object arg
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user