Skip to content

Commit

Permalink
Merge #4625
Browse files Browse the repository at this point in the history
4625: chore(ci): rerun failed tests, scan log, report flaky tests r=menski a=pihme

## Description

* rerun failing tests
* extract flaky tests from log 
* collect flaky tests at the end and add them to description

## Related issues

closes #4347

#

Co-authored-by: pihme <pihme@users.noreply.github.com>
  • Loading branch information
zeebe-bors[bot] and pihme committed Jun 8, 2020
2 parents e71ffa8 + 7c281cf commit 93a464f
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 4 deletions.
16 changes: 15 additions & 1 deletion .ci/scripts/distribution/it-java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,24 @@ export JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS -XX:MaxRAMFraction=$((LIMITS_CPU))"

tmpfile=$(mktemp)

mvn -o -B --fail-never -T$LIMITS_CPU -s ${MAVEN_SETTINGS_XML} verify -P skip-unstable-ci,parallel-tests -pl qa/integration-tests -pl upgrade-tests -DtestMavenId=2 | tee ${tmpfile}
mvn -o -B --fail-never -T$LIMITS_CPU -s ${MAVEN_SETTINGS_XML} verify -P skip-unstable-ci,parallel-tests -pl qa/integration-tests -pl upgrade-tests -DtestMavenId=2 -Dsurefire.rerunFailingTestsCount=5 | tee ${tmpfile}

status=${PIPESTATUS[0]}

if grep -q "\[WARNING\] Flakes:" ${tmpfile}; then

tmpfile2=$(mktemp)

awk '/^\[WARNING\] Flakes:.*$/{flag=1}/^\[ERROR\] Tests run:.*Flakes: [0-9]*$/{print;flag=0}flag' ${tmpfile} > ${tmpfile2}

grep "\[ERROR\] Run 1: " ${tmpfile} | awk '{print $4}' >> ./target/FlakyTests.txt

echo ERROR: Flaky Tests detected>&2
rm test-it.txt
rm flaky-tests-log.txt
exit 1
fi

if [[ $status != 0 ]]; then
exit $status;
fi
Expand Down
15 changes: 14 additions & 1 deletion .ci/scripts/distribution/test-java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,23 @@ export JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS -XX:MaxRAMFraction=$((LIMITS_CPU))"

tmpfile=$(mktemp)

mvn -o -B --fail-never -T$LIMITS_CPU -s ${MAVEN_SETTINGS_XML} verify -P skip-unstable-ci,parallel-tests -Dzeebe.it.skip -DtestMavenId=1 | tee ${tmpfile}
mvn -o -B --fail-never -T$LIMITS_CPU -s ${MAVEN_SETTINGS_XML} verify -P skip-unstable-ci,parallel-tests -Dzeebe.it.skip -DtestMavenId=1 -Dsurefire.rerunFailingTestsCount=5 | tee ${tmpfile}

status=${PIPESTATUS[0]}

if grep -q "\[WARNING\] Flakes:" ${tmpfile}; then

tmpfile2=$(mktemp)

awk '/^\[WARNING\] Flakes:.*$/{flag=1}/^\[ERROR\] Tests run:.*Flakes: [0-9]*$/{print;flag=0}flag' ${tmpfile} > ${tmpfile2}

grep "\[ERROR\] Run 1: " ${tmpfile2} | awk '{print $4}' >> ./target/FlakyTests.txt

echo ERROR: Flaky Tests detected>&2

exit 1
fi

if [[ $status != 0 ]]; then
exit $status;
fi
Expand Down
18 changes: 16 additions & 2 deletions .ci/scripts/distribution/test-java8.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
#!/bin/bash -eux


export JAVA_TOOL_OPTIONS="$JAVA_TOOL_OPTIONS -XX:MaxRAMFraction=$((LIMITS_CPU))"

mvn -v

tmpfile=$(mktemp)

mvn -o -B --fail-never -T$LIMITS_CPU -s ${MAVEN_SETTINGS_XML} verify -pl clients/java -DtestMavenId=3 | tee ${tmpfile}
mvn -o -B --fail-never -T$LIMITS_CPU -s ${MAVEN_SETTINGS_XML} verify -pl clients/java -DtestMavenId=3 -Dsurefire.rerunFailingTestsCount=5 | tee ${tmpfile}

status=${PIPESTATUS[0]}


if grep -q "\[WARNING\] Flakes:" ${tmpfile}; then

tmpfile2=$(mktemp)

awk '/^\[WARNING\] Flakes:.*$/{flag=1}/^\[ERROR\] Tests run:.*Flakes: [0-9]*$/{print;flag=0}flag' ${tmpfile} > ${tmpfile2}

grep "\[ERROR\] Run 1: " ${tmpfile2} | awk '{print $4}' >> ./target/FlakyTests.txt

echo ERROR: Flaky Tests detected>&2

exit 1
fi


if [[ $status != 0 ]]; then
exit $status;
fi
Expand Down
5 changes: 5 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ pipeline {
post {
failure {
archive "**/*/surefire-reports/*-output.txt"
script {
if (fileExists('./target/FlakyTests.txt')) {
currentBuild.description = "Flaky Tests: <br>" + readFile('./target/FlakyTests.txt').split('\n').join('<br>')
}
}
}
}
}
Expand Down

0 comments on commit 93a464f

Please sign in to comment.