Skip to content

Commit

Permalink
Update verify-all.sh: added $t to explicitly tell which script had an…
Browse files Browse the repository at this point in the history
… issue during a failed test (#3286)

* Update verify-all.sh:  added $t to explicitly tell which script had an issue in a failed test

* created an array to capture and display failed tests as summary

* created an array to capture and display failed tests as summary

* fixed unbound variable error
  • Loading branch information
TheInvincibleRalph committed Aug 23, 2024
1 parent bcc3161 commit f7d4a87
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 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 @@ -65,19 +66,30 @@ do
if bash "$t" &> /dev/null; then
echo -e "${color_green}SUCCESS${color_norm}"
else
echo -e "${color_red}FAILED${color_norm}"
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

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

exit $ret

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

0 comments on commit f7d4a87

Please sign in to comment.