Skip to content

Commit aaff038

Browse files
kkaarreellansasaki
authored andcommitted
tests: Fix coverage download by supporting arbitrary URL
Signed-off-by: Karel Srot <[email protected]>
1 parent 2ca4b08 commit aaff038

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

scripts/download_packit_coverage.sh

+11-18
Original file line numberDiff line numberDiff line change
@@ -142,22 +142,15 @@ curl --retry 5 -s "${TF_TESTLOG}" &> ${TMPFILE}
142142
echo "TMPFILE=${TMPFILE}"
143143
# probably rewrite, different hardcoded files, need to figure out how to export
144144

145-
# download test coverage
146-
COVERAGE_URL=$( grep "e2e_coverage.txt report is available at" ${TMPFILE} | grep -E -o "https://.*\.txt" )
147-
echo "COVERAGE_URL=${COVERAGE_URL}"
148-
if [ -z "${COVERAGE_URL}" ]; then
149-
echo "Could not parse e2e_coverage.txt URL at from test log ${TF_TESTLOG}"
150-
exit 5
151-
fi
152-
# download the file
153-
curl --retry 5 -L -O ${COVERAGE_URL}
154-
# download upstream test coverage
155-
COVERAGE_URL=$( grep "upstream_coverage.xml report is available at" ${TMPFILE} | grep -E -o "https://.*\.xml" )
156-
echo "COVERAGE_URL=${COVERAGE_URL}"
157-
if [ -z "${COVERAGE_URL}" ]; then
158-
echo "Could not parse upstream_coverage.xml from test log ${TF_TESTLOG}"
159-
exit 5
160-
fi
161-
# download the file
162-
curl --retry 5 -L -O ${COVERAGE_URL}
145+
for REPORT in e2e_coverage.txt upstream_coverage.xml; do
146+
# download test coverage
147+
COVERAGE_URL=$( grep "$REPORT report is available at" ${TMPFILE} | grep -E -o "https://[^[:space:]]*" )
148+
echo "COVERAGE_URL=${COVERAGE_URL}"
149+
if [ -z "${COVERAGE_URL}" ]; then
150+
echo "Could not parse $REPORT URL at from test log ${TF_TESTLOG}"
151+
exit 5
152+
fi
153+
# download the file
154+
curl --retry 5 -L -o "${REPORT}" "${COVERAGE_URL}"
155+
done
163156
rm ${TMPFILE}

0 commit comments

Comments
 (0)