Skip to content

Commit b4ef644

Browse files
TrottMyles Borins
authored and
Myles Borins
committed
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 Reviewed-By: Fedor Indutny <[email protected]>
1 parent 03b20a7 commit b4ef644

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test/sequential/test-http-regr-gh-2928.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,26 @@ var gotRequests = 0;
1818
var gotResponses = 0;
1919

2020
function execAndClose() {
21-
process.stdout.write('.');
2221
if (parsers.length === 0)
2322
return;
23+
process.stdout.write('.');
2424

2525
const parser = parsers.pop();
2626
parser.reinitialize(HTTPParser.RESPONSE);
27+
2728
const socket = net.connect(common.PORT);
29+
socket.on('error', (e) => {
30+
// If SmartOS and ECONNREFUSED, then retry. See
31+
// https://github.com/nodejs/node/issues/2663.
32+
if (common.isSunOS && e.code === 'ECONNREFUSED') {
33+
parsers.push(parser);
34+
socket.destroy();
35+
setImmediate(execAndClose);
36+
return;
37+
}
38+
throw e;
39+
});
40+
2841
parser.consume(socket._handle._externalStream);
2942

3043
parser.onIncoming = function onIncoming() {

0 commit comments

Comments
 (0)