test: fix flaky test-net-error-twice
authorBrian White <mscdex@mscdex.net>
Fri, 18 Dec 2015 06:35:23 +0000 (01:35 -0500)
committerMyles Borins <mborins@us.ibm.com>
Tue, 19 Jan 2016 19:52:27 +0000 (11:52 -0800)
commit980852165fe6a7317843c76f7db4808c1589e60b
tree058cc5519cbe6c9e4ac33c63678e45a37989beb0
parent1bc44e79d37aaaac64f607949242dd383bc71a2e
test: fix flaky test-net-error-twice

On Windows there can exist some race condition where the
notification of the client's `socket.destroy()` isn't received
before the server writes to the socket. This race condition was
more evident/reproducible on a single core system.

This commit fixes the flakiness by waiting until the server's
connection event handler has been called to destroy the client
socket and perform the server socket write.

Fixes: https://github.com/nodejs/node/issues/4057
PR-URL: https://github.com/nodejs/node/pull/4342
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: João Reis <reis@janeasystems.com>
test/parallel/test-net-error-twice.js