Test:Capture output on fork test failures #3052
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For the currently flaky Sidekiq test, https://app.circleci.com/pipelines/github/DataDog/dd-trace-rb/11471/workflows/136d17b9-9561-4937-b59c-66fb2dbadd0c/jobs/430307, the failure information is a rather generic
Wait time exhausted!
error.I can make Sidekiq tests fail with
Wait time exhausted!
locally, by not having Redis running.But this doesn't explain the CI failures because only a single Sidekiq test failes, while if Redis wasn't running virtually all of them would fail.
Also, the Redis containers' output in CircleCI's log looks nominal.
What this PR does
One thing that I notice lacking in the Sidekiq tests is any useful output during a failure.
This happens because tests executed in a forked process, and that fork's STDOUT and STDERR are not directly printed in the RSpec process.
This PR captures the forked process' outputs and prints them out when there's a test failure.
This should allow us to debug this Sidekiq issue better when it happens again in CircleCI.
This change should improving the debug of all forked test process, given it affect the shared test helper.