From bf1bc2149802d314dfdf1a41e76fae3e03ff763c Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Wed, 11 May 2022 12:01:35 +0200 Subject: [PATCH 1/2] ci-automation: Do not rerun tests on unrelated instances We forgot to clear the array with instance tests to rerun, so the list grew from one iteration to another when going over all the instance types. I did not spot it before, because I tested it with only one extra instance. --- ci-automation/vendor_test.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ci-automation/vendor_test.sh b/ci-automation/vendor_test.sh index 77fbd7b4f3..443add5821 100644 --- a/ci-automation/vendor_test.sh +++ b/ci-automation/vendor_test.sh @@ -155,6 +155,9 @@ function filter_prefixed_tests() { local -n results="${var_name}" local name local stripped_name + # clear the array, so it will contain results of current filtering + # only + results=() for name; do stripped_name="${name#extra-test.\[${prefix}\].}" if [[ "${stripped_name}" != "${name}" ]]; then @@ -181,6 +184,9 @@ function filter_out_prefixed_tests() { local var_name="${1}"; shift local -n results="${var_name}" local name + # clear the array, so it will contain results of current filtering + # only + results=() for name; do if [[ "${name#extra-test.}" = "${name}" ]]; then results+=( "${name}" ) From 8c3d7b977b72b7b9efb2706c68e2015ef3fe950b Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Wed, 11 May 2022 12:43:06 +0200 Subject: [PATCH 2/2] ci-automation: Fix potential use of unbound variable error `local -a stuff` does not make `stuff` a bound array variable, so checking length of the array will trigger an error about unbound variable. Fortunately, `local stuff=()` does the trick. --- ci-automation/vendor_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-automation/vendor_test.sh b/ci-automation/vendor_test.sh index 443add5821..f0d657e36d 100644 --- a/ci-automation/vendor_test.sh +++ b/ci-automation/vendor_test.sh @@ -369,7 +369,7 @@ function run_kola_tests_on_instances() { fi done - local -a main_tests + local main_tests=() filter_out_prefixed_tests main_tests "${@}" if [[ "${#main_tests[@]}" -gt 0 ]]; then