mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Colorize string test helper results
This commit is contained in:
parent
221b60fb82
commit
af059a0731
@ -328,12 +328,16 @@ kube::test::if_has_string() {
|
|||||||
local match=$2
|
local match=$2
|
||||||
|
|
||||||
if grep -q "${match}" <<< "${message}"; then
|
if grep -q "${match}" <<< "${message}"; then
|
||||||
|
echo -n "${green}"
|
||||||
echo "Successful"
|
echo "Successful"
|
||||||
|
echo -n "${reset}"
|
||||||
echo "message:${message}"
|
echo "message:${message}"
|
||||||
echo "has:${match}"
|
echo "has:${match}"
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
echo -n "${bold}${red}"
|
||||||
echo "FAIL!"
|
echo "FAIL!"
|
||||||
|
echo -n "${reset}"
|
||||||
echo "message:${message}"
|
echo "message:${message}"
|
||||||
echo "has not:${match}"
|
echo "has not:${match}"
|
||||||
caller
|
caller
|
||||||
@ -346,13 +350,17 @@ kube::test::if_has_not_string() {
|
|||||||
local match=$2
|
local match=$2
|
||||||
|
|
||||||
if grep -q "${match}" <<< "${message}"; then
|
if grep -q "${match}" <<< "${message}"; then
|
||||||
|
echo -n "${bold}${red}"
|
||||||
echo "FAIL!"
|
echo "FAIL!"
|
||||||
|
echo -n "${reset}"
|
||||||
echo "message:${message}"
|
echo "message:${message}"
|
||||||
echo "has:${match}"
|
echo "has:${match}"
|
||||||
caller
|
caller
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
|
echo -n "${green}"
|
||||||
echo "Successful"
|
echo "Successful"
|
||||||
|
echo -n "${reset}"
|
||||||
echo "message:${message}"
|
echo "message:${message}"
|
||||||
echo "has not:${match}"
|
echo "has not:${match}"
|
||||||
return 0
|
return 0
|
||||||
@ -362,11 +370,16 @@ kube::test::if_has_not_string() {
|
|||||||
kube::test::if_empty_string() {
|
kube::test::if_empty_string() {
|
||||||
local match=$1
|
local match=$1
|
||||||
if [ -n "${match}" ]; then
|
if [ -n "${match}" ]; then
|
||||||
|
echo -n "${bold}${red}"
|
||||||
|
echo "FAIL!"
|
||||||
echo "${match} is not empty"
|
echo "${match} is not empty"
|
||||||
|
echo -n "${reset}"
|
||||||
caller
|
caller
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
|
echo -n "${green}"
|
||||||
echo "Successful"
|
echo "Successful"
|
||||||
|
echo -n "${reset}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user