Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: retry on known SmartOS bug
There is a known issue with SmartOS that is generally worked around
in `tools/test.py`. However, a more robust workaround is required for
some tests that open many network connections.

`test-http-regr-gh-2928` is one such test.

Fixes: #5445
Refs: #3941
PR-URL: #5454
  • Loading branch information
Trott committed Mar 1, 2016
commit bb388bc7e85e3b75d3d77b943473d47807496f3e
15 changes: 14 additions & 1 deletion test/sequential/test-http-regr-gh-2928.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,26 @@ var gotRequests = 0;
var gotResponses = 0;

function execAndClose() {
process.stdout.write('.');
if (parsers.length === 0)
return;
process.stdout.write('.');

const parser = parsers.pop();
parser.reinitialize(HTTPParser.RESPONSE);

const socket = net.connect(common.PORT);
socket.on('error', (e) => {
// If SmartOS and ECONNREFUSED, then retry. See
// https://github.com/nodejs/node/issues/2663.
if (common.isSunOS && e.code === 'ECONNREFUSED') {
parsers.push(parser);
socket.destroy();
setImmediate(execAndClose);
return;
}
throw e;
});

parser.consume(socket._handle._externalStream);

parser.onIncoming = function onIncoming() {
Expand Down