Skip to content

Commit

Permalink
created an array to capture and display failed tests as summary
Browse files Browse the repository at this point in the history
  • Loading branch information
TheInvincibleRalph committed Aug 21, 2024
1 parent c2af30b commit 08cdd17
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion hack/verify-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${SCRIPT_ROOT}/hack/kube-env.sh"

SILENT=true
FAILED_TEST=()

function is-excluded {
for e in $EXCLUDE; do
Expand Down Expand Up @@ -66,18 +67,27 @@ do
echo -e "${color_green}SUCCESS${color_norm}"
else
echo -e "${color_red}FAILED: $t ${color_norm}"
FAILED_TEST+=("$t")
ret=1
fi
else
if bash "$t"; then
echo -e "${color_green}SUCCESS: $t ${color_norm}"
else
echo -e "${color_red}Test FAILED: $t ${color_norm}"
FAILED_TEST+=("$t")
ret=1
fi
fi
done

exit $ret
if [ ${#FAILED_TESTS[@]} -ne 0 ]; then
echo -e "\n${color_red}Summary of failed tests:${color_norm}"
for test in "${FAILED_TESTS[@]}"; do
echo -e "${color_red}- $test${color_norm}"
done
else
echo -e "\n${color_green}All tests passed successfully.${color_norm}"
fi

# ex: ts=2 sw=2 et filetype=sh

0 comments on commit 08cdd17

Please sign in to comment.