Fix abort test timing to be consistent from node v12 through v16 #4239
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.
This fixes a test failure surfaced by citgm against node v16 nightly nodejs/citgm#852. In the past we have seen this test be a bit flaky on OSX— hopefully this addresses that issue as well.
The issue is that the test relies on the relative timing of various node events. Previously three requests were made to hapi, and during the first one the requests are aborted by the client. For previous versions of node, the first two of those three requests were able to make it through before the server saw the client disconnect. In node v16 the disconnect occurs nearly immediately, and only the first of the three requests were able to make it through. To fix this, I ensure that the second and third requests experience the disconnect during the pre-handler.