Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): rerun failed tests, scan log, report flaky tests #4625

Merged
merged 1 commit into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -189,6 +189,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