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.
This commit is contained in:
Krzesimir Nowak 2022-11-08 13:38:55 +01:00
parent 63a6f60971
commit bdebbc8ed9

View File

@ -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 }'
}