Skip to content

test: fix test-async-wrap-getasyncid flakyness

The test used to assume that if the client successfully writes data to the server and closes the connection, then the server must have received that data and ran its connection callback wrapped by common.mustCall.

However, it is not necessarily the case, and as a result the test was flaky.

With this change, the server is closed only once the server's connection callback has been called, which guarantees that the server can accept connections until it actually accepted the single connection that this test requires to accept, making the test not flaky.

Fixes: https://github.com/nodejs/node/issues/13020

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • [ ] tests and/or benchmarks are included not relevant in this case
  • [ ] documentation is changed or added not relevant in this case
  • commit message follows commit guidelines
Affected core subsystem(s)

test

Merge request reports

Loading