@@ -338,14 +338,21 @@ jobs:
338
338
else
339
339
echo ::set-output name=cover::false
340
340
fi
341
+ set +e
341
342
gotestsum --junitfile="gotests.xml" --jsonfile="gotestsum.json" --packages="./..." --debug -- -parallel=8 -timeout=5m -short -failfast $COVERAGE_FLAGS
342
343
ret=$?
343
344
if ((ret)); then
344
345
# Eternalize test timeout logs because "re-run failed" erases
345
346
# artifacts and gotestsum doesn't always capture it:
346
347
# https://github.com/gotestyourself/gotestsum/issues/292
347
- echo "Checking gotestsum.json for panic trace:"
348
- grep -A 999999 'panic: test timed out' gotestsum.json
348
+ # Multiple test packages could've failed, each one may or may
349
+ # not run into the edge case. PS. Don't summon ShellCheck here.
350
+ for testWithStack in $(grep 'panic: test timed out' gotestsum.json | grep -E -o '("Test":[^,}]*)'); do
351
+ if [ -n "$testWithStack" ] && grep -q "${testWithStack}.*PASS" gotestsum.json; then
352
+ echo "Conditions met for gotestsum stack trace missing bug, outputting panic trace:"
353
+ grep -A 999999 "${testWithStack}.*panic: test timed out" gotestsum.json
354
+ fi
355
+ done
349
356
fi
350
357
exit $ret
351
358
@@ -423,14 +430,21 @@ jobs:
423
430
424
431
- name : Test with PostgreSQL Database
425
432
run : |
433
+ set +e
426
434
make test-postgres
427
435
ret=$?
428
436
if ((ret)); then
429
437
# Eternalize test timeout logs because "re-run failed" erases
430
438
# artifacts and gotestsum doesn't always capture it:
431
439
# https://github.com/gotestyourself/gotestsum/issues/292
432
- echo "Checking gotestsum.json for panic trace:"
433
- grep -A 999999 'panic: test timed out' gotestsum.json
440
+ # Multiple test packages could've failed, each one may or may
441
+ # not run into the edge case. PS. Don't summon ShellCheck here.
442
+ for testWithStack in $(grep 'panic: test timed out' gotestsum.json | grep -E -o '("Test":[^,}]*)'); do
443
+ if [ -n "$testWithStack" ] && grep -q "${testWithStack}.*PASS" gotestsum.json; then
444
+ echo "Conditions met for gotestsum stack trace missing bug, outputting panic trace:"
445
+ grep -A 999999 "${testWithStack}.*panic: test timed out" gotestsum.json
446
+ fi
447
+ done
434
448
fi
435
449
exit $ret
436
450
0 commit comments