-
Notifications
You must be signed in to change notification settings - Fork 945
run_tests_in_ci.js: fix truncated log output #7553
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
Conversation
…ess.exit(1)` to fix truncated output
|
process.exitCode=1
instead of calling process.exit(1)
to fix truncated output
Size Report 1Affected Products
Test Logs |
Have you tested to ensure that GHA evaluates the return code correctly to detect that an error has occurred? |
Size Analysis Report 1Affected Products
Test Logs |
I've tested locally, but that's a good point. I'll test it out in CI as well. Thanks for the idea. |
…ses the GitHub Actions to fail
…re stdout/stderr, rather than implementing it ourselves since our own implementation seems to truncate the output, probably due to a misunderstanding of output buffering.
…he 'child-process-promise' library, so that capturing output is fully controlled and does not truncate.
…tting the exception bubble up, to avoid truncating output
This PR fixes a long-standing bug in the GitHub continuous integration tests where the logs from failed tests were truncated, masking the failures, making investigation nearly impossible. The problem was in
scripts/run_tests_in_ci.js
which buffered the test command's output in memory then printed it after the fact.In order to ensure that the script completed with a non-zero exit code (to indicate test failure) it called
process.exit(1)
(docs). The problem is thatprocess.exit()
documents that itSo the first problem was that
run_tests_in_ci.js
callingprocess.exit(1)
would terminate the process before the test logs had been completely written to stdout/stderr, leading to truncated log output.The fix is to instead set
process.exitCode=1
, which tells node to use the given exit code once all asynchronous work has completed, including flushing stdout/stderr.The second problem had to do with how the output from the command was manually captured and was being printed before it was fully buffered from the child process. The fix for this was to directly use node's
child_process
module rather than thechild-process-promise
dependency so that output capturing could be reliably implemented.