Skip to content

Commit aeb8d66

Browse files
Julien Gilliaddaleax
Julien Gilli
authored andcommitted
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. PR-URL: #14329 Fixes: #13020 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Wyatt Preul <[email protected]>
1 parent 3c50c59 commit aeb8d66

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/parallel/test-async-wrap-getasyncid.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ if (common.hasCrypto) {
160160
const stream_wrap = process.binding('stream_wrap');
161161
const tcp_wrap = process.binding('tcp_wrap');
162162
const server = net.createServer(common.mustCall((socket) => {
163+
server.close();
163164
socket.on('data', (x) => {
164165
socket.end();
165166
socket.destroy();
@@ -176,7 +177,6 @@ if (common.hasCrypto) {
176177

177178
sreq.oncomplete = common.mustCall(() => {
178179
handle.close();
179-
server.close();
180180
});
181181

182182
wreq.handle = handle;

0 commit comments

Comments
 (0)