test: Make log errors easier to find

We were using greenprint for failures, which makes it hard to quickly
find where the tests failed. This switches errors to use redprint, and
adds it to places that were simply using echo before doing an exit 1.
This commit is contained in:
Brian C. Lane 2023-07-26 08:51:11 -07:00 committed by Ondřej Budai
parent f889be9e05
commit 4c7b3dd25a
15 changed files with 55 additions and 54 deletions

View file

@ -4,6 +4,7 @@ set -euo pipefail
#
# Script that executes different high level sanity tests writen in GO.
#
source /usr/libexec/tests/osbuild-composer/shared_lib.sh
WORKING_DIRECTORY=/usr/libexec/osbuild-composer
TESTS_PATH=/usr/libexec/osbuild-composer-test
@ -67,15 +68,15 @@ done
# Print a report of the test results.
test_divider
echo "😃 Passed tests:" "${PASSED_TESTS[@]}"
echo "☹ Failed tests:" "${FAILED_TESTS[@]}"
greenprint "😃 Passed tests:" "${PASSED_TESTS[@]}"
redprint "☹ Failed tests:" "${FAILED_TESTS[@]}"
test_divider
# Exit with a failure if tests were executed and any of them failed.
if [ ${#PASSED_TESTS[@]} -gt 0 ] && [ ${#FAILED_TESTS[@]} -eq 0 ]; then
echo "🎉 All tests passed."
greenprint "🎉 All tests passed."
exit 0
else
echo "🔥 One or more tests failed."
redprint "🔥 One or more tests failed."
exit 1
fi