ci-automation/test.sh: fix reruns, set retry to 20

Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
This commit is contained in:
Thilo Fromm 2022-02-18 14:40:18 +01:00
parent 95ef0b7322
commit a5b958fd07
2 changed files with 10 additions and 8 deletions

View File

@ -25,4 +25,4 @@ CONTAINER_IMAGE_ROOT="/home/sdk/build/images"
# Image / vendor tests settings # Image / vendor tests settings
QEMU_IMAGE_NAME="flatcar_production_image.bin" QEMU_IMAGE_NAME="flatcar_production_image.bin"
QEMU_PARALLEL=4 QEMU_PARALLEL=20

View File

@ -35,7 +35,7 @@
# 3. List of tests / test patterns. Defaults to "*" (all tests). # 3. List of tests / test patterns. Defaults to "*" (all tests).
# All positional arguments after the first 2 (see above) are tests / patterns of tests to run. # All positional arguments after the first 2 (see above) are tests / patterns of tests to run.
# #
# MAX_RETRIES. Environment variable. Number of re-runs to overcome transient failures. Defaults to 999. # MAX_RETRIES. Environment variable. Number of re-runs to overcome transient failures. Defaults to 20.
# #
# OUTPUT: # OUTPUT:
# #
@ -58,7 +58,7 @@ function test_run() {
set -- '*' set -- '*'
fi fi
local retries="${MAX_RETRIES:-999}" local retries="${MAX_RETRIES:-20}"
source ci-automation/tapfile_helper_lib.sh source ci-automation/tapfile_helper_lib.sh
source ci-automation/ci_automation_common.sh source ci-automation/ci_automation_common.sh
@ -84,9 +84,11 @@ function test_run() {
local success=false local success=false
for retry in $(seq "${retries}"); do for retry in $(seq "${retries}"); do
local tapfile="results-run-${retry}.tap" local tapfile="results-run-${retry}.tap"
local failfile="failed-run-${retry}." local failfile="failed-run-${retry}.txt"
set -o noglob # Ignore retcode since tests are flaky. We'll re-run failed tests and
# determine success based on test results (tapfile).
set +e -o noglob
./run_sdk_container -x ./ci-cleanup.sh \ ./run_sdk_container -x ./ci-cleanup.sh \
-n "${container_name}" -C "${packages_image}" -v "${vernum}" \ -n "${container_name}" -C "${packages_image}" -v "${vernum}" \
ci-automation/vendor-testing/"${image}".sh \ ci-automation/vendor-testing/"${image}".sh \
@ -95,16 +97,16 @@ function test_run() {
"${vernum}" \ "${vernum}" \
"${tapfile}" \ "${tapfile}" \
$@ $@
set +o noglob set -e +o noglob
./run_sdk_container -x ./ci-cleanup.sh \ ./run_sdk_container -x ./ci-cleanup.sh \
-n "${container_name}" -C "${packages_image}" -v "${vernum}" \ -n "${container_name}" -C "${packages_image}" -v "${vernum}" \
ci-automation/test_update_reruns.sh \ ci-automation/test_update_reruns.sh \
"${tests_dir}/${tapfile}" "${image}" "${retry}" \ "${tests_dir}/${tapfile}" "${image}" "${retry}" \
"${tests_dir}/failed-run-${retry}.txt" "${tests_dir}/${failfile}"
local failed_tests local failed_tests
failed_tests="$(cat "${tests_dir}/failed-run-${retry}.txt")" failed_tests="$(cat "${tests_dir}/${failfile}")"
if [ -z "$failed_tests" ] ; then if [ -z "$failed_tests" ] ; then
echo "########### All tests succeeded. ###########" echo "########### All tests succeeded. ###########"
success=true success=true