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.
The beforeEach() hook was not awaited, so afterEach() could run before it completed, resulting in a client.disconnect() that rejects, and a mocha hook that calls done() twice.
Refs: #1860
details
The redis-4 tests are sometimes failing as follows. There is a timing race in the test.
With this patch to add some debug prints:
the relevant section of the test output of a failing run looks like this:
The issue is that in one of the test cases that runs quickly, the
client.disconnect()
in theafterEach()
hook is running before theclient.connect()
in thebeforeEach()
has completed, and that results inclient.disconnect()
rejecting:This race can happen because the
beforeEach()
hook is not awaited. This changed by accident in a change to thebeforeEach()
hook in #1125.That change also added a test case --
sets error status on connection failure
-- that runs fast enough to sometimes trigger this.