Merge pull request #437 from flatcar-linux/scripts

Small cleanups in tests
This commit is contained in:
Krzesimir Nowak 2022-08-31 12:11:29 +02:00
commit 80f96ed35d
2 changed files with 18 additions and 11 deletions

View File

@ -154,6 +154,8 @@ function _test_run_impl() {
local tap_merged_detailed="results-${image}-detailed.tap"
local retry=""
local success=false
local print_give_up=true
local failed_tests=()
# A job on each worker prunes old mantle images (docker image prune)
echo "docker rm -f '${container_name}'" >> ./ci-cleanup.sh
@ -188,32 +190,32 @@ function _test_run_impl() {
"${tap_merged_summary}" \
"${tap_merged_detailed}"
local failed_tests
failed_tests="$(cat "${tests_dir}/${failfile}")"
if [ -z "$failed_tests" ] ; then
readarray -t failed_tests <"${tests_dir}/${failfile}"
if [ "${#failed_tests[@]}" -eq 0 ] ; then
echo "########### All tests succeeded. ###########"
success=true
print_give_up=false
break
fi
if retest_cycle_broken; then
echo "########### Test cycle requested to break ###########"
echo "Failed tests: $failed_tests"
echo "Failed tests:"
printf '%s\n' "${failed_tests[@]}"
echo "-----------"
# not really a success, but don't print a message about
# exhaused reruns and giving up
success=true
print_give_up=false
break
fi
echo "########### Some tests failed and will be re-run (${retry} / ${retries}). ###########"
echo "Failed tests: $failed_tests"
echo "Failed tests:"
printf '%s\n' "${failed_tests[@]}"
echo "-----------"
set -- $failed_tests
set -- "${failed_tests[@]}"
done
if ! $success; then
if ${print_give_up}; then
echo "########### All re-runs exhausted ($retries). Giving up. ###########"
fi

View File

@ -13,7 +13,12 @@ set -euo pipefail
source ci-automation/vendor_test.sh
if [ "$*" != "" ] && [ "$*" != "*" ] && [ "$*" != "cl.update.payload" ]; then
echo "Only cl.update.payload is supported, got '$*'"
echo "1..1" > "${CIA_TAPFILE}"
echo "not ok - all qemu update tests" >> "${CIA_TAPFILE}"
echo " ---" >> "${CIA_TAPFILE}"
echo " ERROR: Only cl.update.payload is supported, got '$*'." | tee -a "${CIA_TAPFILE}"
echo " ..." >> "${CIA_TAPFILE}"
break_retest_cycle
exit 1
fi