Skip to content

Commit

Permalink
HDDS-11551. Provide details about integration check failure (#7294)
Browse files Browse the repository at this point in the history
  • Loading branch information
adoroszlai authored Oct 10, 2024
1 parent 911a583 commit 77c17df
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,11 @@ jobs:
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
- name: Summary of failures
run: hadoop-ozone/dev-support/checks/_summary.sh target/${{ github.job }}/summary.txt
run: |
if [[ -s "target/${{ github.job }}/summary.md" ]]; then
cat target/${{ github.job }}/summary.md >> $GITHUB_STEP_SUMMARY
fi
hadoop-ozone/dev-support/checks/_summary.sh target/${{ github.job }}/summary.txt
if: ${{ !cancelled() }}
- name: Archive build results
uses: actions/upload-artifact@v4
Expand Down
38 changes: 24 additions & 14 deletions hadoop-ozone/dev-support/checks/_mvn_unit_report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,20 @@ _realpath() {
tempfile="${REPORT_DIR}/summary.tmp"

## generate summary txt file
failures=${REPORT_DIR}/failures.txt
find "." -not -path '*/iteration*' -name 'TEST*.xml' -print0 \
| xargs -n1 -0 "grep" -l -E "<failure|<error" \
| awk -F/ '{sub("'"TEST-"'",""); sub(".xml",""); print $NF}' \
> "${tempfile}"
> "${failures}"
cat ${failures} > "${tempfile}"

leaks=${REPORT_DIR}/leaks.txt
if [[ "${CHECK:-unit}" == "integration" ]]; then
find hadoop-ozone/integration-test -not -path '*/iteration*' -name '*-output.txt' -print0 \
| xargs -n1 -0 "grep" -l -E "not closed properly|was not shutdown properly" \
| awk -F/ '{sub("-output.txt",""); print $NF}' \
>> "${tempfile}"
> "${leaks}"
cat ${leaks} >> "${tempfile}"
fi

#Copy heap dump and dump leftovers
Expand All @@ -50,11 +54,13 @@ find "." -not -path '*/iteration*' \
-exec mv {} "$REPORT_DIR/" \;

## Add the tests where the JVM is crashed
crashes=${REPORT_DIR}/crashes.txt
grep -A1 'Crashed tests' "${REPORT_DIR}/output.log" \
| grep -v -e 'Crashed tests' -e '--' \
| cut -f2- -d' ' \
| sort -u \
>> "${tempfile}"
> "${crashes}"
cat "${crashes}" >> "${tempfile}"

# Check for tests that started but were not finished
if grep -q 'There was a timeout.*in the fork' "${REPORT_DIR}/output.log"; then
Expand Down Expand Up @@ -93,20 +99,24 @@ fi

## generate summary markdown file
export SUMMARY_FILE="$REPORT_DIR/summary.md"
for TEST_RESULT_FILE in $(find "$REPORT_DIR" -name "*.txt" | grep -v output); do

FAILURES=$(grep FAILURE "$TEST_RESULT_FILE" | grep "Tests run" | awk '{print $18}' | sort | uniq)
echo -n > "$SUMMARY_FILE"
if [ -s "${failures}" ]; then
printf "# Failed Tests\n\n" >> "$SUMMARY_FILE"
cat "${failures}" | sed 's/^/ * /' >> "$SUMMARY_FILE"
fi
rm -f "${failures}"

for FAILURE in $FAILURES; do
TEST_RESULT_LOCATION="$(_realpath --relative-to="$REPORT_DIR" "$TEST_RESULT_FILE")"
TEST_OUTPUT_LOCATION="${TEST_RESULT_LOCATION//.txt/-output.txt}"
printf " * [%s](%s) ([output](%s))\n" "$FAILURE" "$TEST_RESULT_LOCATION" "$TEST_OUTPUT_LOCATION" >> "$SUMMARY_FILE"
done
done
if [[ -s "${leaks}" ]]; then
printf "# Leaks Detected\n\n" >> "$SUMMARY_FILE"
cat "${leaks}" | sed 's/^/ * /' >> "$SUMMARY_FILE"
fi
rm -f "${leaks}"

if [ -s "$SUMMARY_FILE" ]; then
printf "# Failing tests: \n\n" | cat - "$SUMMARY_FILE" > temp && mv temp "$SUMMARY_FILE"
if [[ -s "${crashes}" ]]; then
printf "# Crashed Tests\n\n" >> "$SUMMARY_FILE"
cat "${crashes}" | sed 's/^/ * /' >> "$SUMMARY_FILE"
fi
rm -f "${crashes}"

## generate counter
wc -l "$REPORT_DIR/summary.txt" | awk '{print $1}'> "$REPORT_DIR/failures"

0 comments on commit 77c17df

Please sign in to comment.