Skip to content

ci: Improve gotestsum failure detection, prevent early exit #5420

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

Merged
merged 5 commits into from
Dec 15, 2022

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Dec 14, 2022

This PR fixes early exit (missing set +e) which prevented the if statement from being executed.

Since the log was too noisy, I applied filtering and edge case detection.

Example output after this PR: https://github.com/coder/coder/actions/runs/3697831254/jobs/6273476923

PS. I never realized, but it seems setting -timeout=Xm like we do applies on a per-package basis, not the entire run of go test. As a result, the entire run can be much longer it seems 🤔 (or am I misunderstanding something?)

@mafredri mafredri force-pushed the mafredri/ci-try-to-fix-ci-exit branch from 9d8ea2f to bce52ce Compare December 14, 2022 17:44
@mafredri mafredri force-pushed the mafredri/ci-try-to-fix-ci-exit branch from 591c69e to d0a3e50 Compare December 14, 2022 17:57
ret=$?
if ((ret)); then
# Eternalize test timeout logs because "re-run failed" erases
# artifacts and gotestsum doesn't always capture it:
# https://github.com/gotestyourself/gotestsum/issues/292
echo "Checking gotestsum.json for panic trace:"
grep -A 999999 'panic: test timed out' gotestsum.json
Copy link
Member Author

@mafredri mafredri Dec 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: This was pretty loud (so many logs after timeout), so I decided to only capture the stack trace, and while I was at it, only when the criteria is met.

@mafredri mafredri changed the title ci: Prevent early exit on gotestsum failure ci: Improve gotestsum failure detection, prevent early exit Dec 14, 2022
@mafredri mafredri marked this pull request as ready for review December 15, 2022 10:37
@mafredri mafredri requested a review from mtojek December 15, 2022 10:37
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mafredri mafredri merged commit 25ebeba into main Dec 15, 2022
@mafredri mafredri deleted the mafredri/ci-try-to-fix-ci-exit branch December 15, 2022 10:47
@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants