Skip to content
Permalink
Browse files

test: fixed flaky test-net-connect-local-error

Fixed test-net-connect-local-error by moving the test from
parallel to sequential.

PR-URL: #12964
Fixes: #12950
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information...
Sebastian Plesciuc authored and refack committed May 15, 2017
1 parent 0083011 commit 0c2edd27e693ef5bb914a25c3257511fe2bb99f6
Showing with 11 additions and 8 deletions.
  1. +11 −8 test/{parallel → sequential}/test-net-connect-local-error.js
@@ -3,25 +3,28 @@ const common = require('../common');
const assert = require('assert');
const net = require('net');

const server = net.createServer();
server.listen(0);
const port = server.address().port;
const client = net.connect({
port: port + 1,
localPort: port,
port: common.PORT + 1,
localPort: common.PORT,
localAddress: common.localhostIPv4
});

client.on('error', common.mustCall(function onError(err) {
assert.strictEqual(err.syscall, 'connect');
assert.strictEqual(err.code, 'ECONNREFUSED');
assert.strictEqual(
err.localPort,
port,
`${err.localPort} !== ${port} in ${err}`
common.PORT,
`${err.localPort} !== ${common.PORT} in ${err}`
);
assert.strictEqual(
err.localAddress,
common.localhostIPv4,
`${err.localAddress} !== ${common.localhostIPv4} in ${err}`
);
assert.strictEqual(
err.message,
`connect ECONNREFUSED ${err.address}:${err.port} ` +
`- Local (${err.localAddress}:${err.localPort})`
);
}));
server.close();

0 comments on commit 0c2edd2

Please sign in to comment.
You can’t perform that action at this time.