From aaff038cc0534ce2d07f3bbd048afcdb7c52fa79 Mon Sep 17 00:00:00 2001 From: Karel Srot Date: Wed, 20 Mar 2024 13:54:34 +0100 Subject: [PATCH] tests: Fix coverage download by supporting arbitrary URL Signed-off-by: Karel Srot --- scripts/download_packit_coverage.sh | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/scripts/download_packit_coverage.sh b/scripts/download_packit_coverage.sh index c5879c33..0d37fc54 100755 --- a/scripts/download_packit_coverage.sh +++ b/scripts/download_packit_coverage.sh @@ -142,22 +142,15 @@ curl --retry 5 -s "${TF_TESTLOG}" &> ${TMPFILE} echo "TMPFILE=${TMPFILE}" # probably rewrite, different hardcoded files, need to figure out how to export -# download test coverage -COVERAGE_URL=$( grep "e2e_coverage.txt report is available at" ${TMPFILE} | grep -E -o "https://.*\.txt" ) -echo "COVERAGE_URL=${COVERAGE_URL}" -if [ -z "${COVERAGE_URL}" ]; then - echo "Could not parse e2e_coverage.txt URL at from test log ${TF_TESTLOG}" - exit 5 -fi -# download the file -curl --retry 5 -L -O ${COVERAGE_URL} -# download upstream test coverage -COVERAGE_URL=$( grep "upstream_coverage.xml report is available at" ${TMPFILE} | grep -E -o "https://.*\.xml" ) -echo "COVERAGE_URL=${COVERAGE_URL}" -if [ -z "${COVERAGE_URL}" ]; then - echo "Could not parse upstream_coverage.xml from test log ${TF_TESTLOG}" - exit 5 -fi -# download the file -curl --retry 5 -L -O ${COVERAGE_URL} +for REPORT in e2e_coverage.txt upstream_coverage.xml; do + # download test coverage + COVERAGE_URL=$( grep "$REPORT report is available at" ${TMPFILE} | grep -E -o "https://[^[:space:]]*" ) + echo "COVERAGE_URL=${COVERAGE_URL}" + if [ -z "${COVERAGE_URL}" ]; then + echo "Could not parse $REPORT URL at from test log ${TF_TESTLOG}" + exit 5 + fi + # download the file + curl --retry 5 -L -o "${REPORT}" "${COVERAGE_URL}" +done rm ${TMPFILE}