Skip to content

Commit 7764854

Browse files
author
Julien Gilli
committed
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: nodejs#13020
1 parent a6cec04 commit 7764854

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)