Skip to contentSkip to conversation

scripts: run-lava-tests: Improve detection of failed jobs

PATCH New Jan Kiszka 1 participant 1 message Jul 5, 2024

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 scripts: run-lava-tests: Improve detection of failed jobs

From: Jan Kiszka <[email protected]>

Rather than counting errors and failures, only query for the failed testcase "job". That avoids reporting failures when some job was successfully retried, specifically download jobs.

---
 scripts/install-lavacli.sh | 2 +-
 scripts/run-lava-tests.sh  | 5 +----
 2 files changed, 2 insertions(+), 5 deletions(-)
scripts/install-lavacli.sh +1 -1
index 7f7a052..ae61497 100755
@@ -14,7 +14,7 @@
 # with the lava master on Debian 10.
 os_version_id=$(sed -nr 's/VERSION_ID="([0-9]+)"/\1/p' /etc/os-release)
 sudo apt-get update
-sudo apt-get install -y jq
+sudo apt-get install -y jq xmlstarlet
 if [ "${os_version_id}" -ge "10" ]; then
     sudo apt-get install -y lavacli
 else
scripts/run-lava-tests.sh +1 -4
index 046d56b..d478a11 100755
@@ -61,9 +61,6 @@ url="${api}/${auth}"
 curl --silent "${url}" -o report.xml
 
 # change return code to generate a error in gitlab-ci if a test is failed
-errors=$(get_first_xml_attr_value report.xml errors)
-failures=$(get_first_xml_attr_value report.xml failures)
-
-if [ "${errors}" -gt "0" ] || [ "${failures}" -gt "0" ]; then
+if xmlstarlet sel -t  -v "/testsuites/testsuite/testcase[@name='job']/failure/@type" report.xml; then
 	exit 1
 fi
Signature · 1 line
2.43.0