From bdebbc8ed9e8e1532fb59c1e872fd63237e2d59e Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Tue, 8 Nov 2022 13:38:55 +0100 Subject: [PATCH] ci-automation: Add a kola test query runner It makes sure that the output of it is purely a list of kola tests to run, without all the other unnecessary stuff. --- ci-automation/vendor_test.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ci-automation/vendor_test.sh b/ci-automation/vendor_test.sh index 878cdc9ebf..72f751d5d7 100644 --- a/ci-automation/vendor_test.sh +++ b/ci-automation/vendor_test.sh @@ -324,7 +324,6 @@ function run_kola_tests_on_instances() { # rest of the parameters are tests to be run or rerun local instance_type - local queried_tests local instance_tests=() local tests_on_instances_running=0 local other_tests_for_fgrep @@ -342,8 +341,7 @@ function run_kola_tests_on_instances() { # to filter the extra tests first then we decide which tests # should be run. if [[ "${is_first_run}" -eq 1 ]]; then - queried_tests="$(query_kola_tests "${instance_type}" "${@}")" - mapfile -t instance_tests < <(grep --only-matching --fixed-strings "${other_tests_for_fgrep}" <<<"${queried_tests}" || :) + mapfile -t instance_tests < <(run_query_kola_tests "${instance_type}" "${@}" | grep --only-matching --fixed-strings "${other_tests_for_fgrep}" || :) else filter_prefixed_tests instance_tests "${instance_type}" "${@}" fi @@ -385,3 +383,11 @@ function run_kola_tests_on_instances() { rm -f 'instance_'*'_validate.tap' fi } + +# Runs the user-defined query_kola_tests callback and massages its +# output so only a list of tests is printed. +function run_query_kola_tests() { + # The "-n +3" option will skip the table header and the empty line + # that follows it. + query_kola_tests "${@}" | tail -n +3 | awk '{ print $1 }' +}