diff options
author | Rich Trott <rtrott@gmail.com> | 2016-02-26 09:29:19 -0800 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2016-03-01 13:35:48 -0800 |
commit | 859269724cfd02ed2d1401f81c4b80d0619941b2 (patch) | |
tree | e84cab07490c3bc7aa1210a6cf7e4e8d0da73989 /test/sequential/test-http-regr-gh-2928.js | |
parent | 32719950df8e792684a49b89fe03a00bf65c7010 (diff) | |
download | android-node-v8-859269724cfd02ed2d1401f81c4b80d0619941b2.tar.gz android-node-v8-859269724cfd02ed2d1401f81c4b80d0619941b2.tar.bz2 android-node-v8-859269724cfd02ed2d1401f81c4b80d0619941b2.zip |
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: https://github.com/nodejs/node/issues/5445
Refs: https://github.com/nodejs/node/pull/3941
PR-URL: https://github.com/nodejs/node/pull/5454
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Diffstat (limited to 'test/sequential/test-http-regr-gh-2928.js')
-rw-r--r-- | test/sequential/test-http-regr-gh-2928.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/sequential/test-http-regr-gh-2928.js b/test/sequential/test-http-regr-gh-2928.js index 975eb84e76..b4ae7054d7 100644 --- a/test/sequential/test-http-regr-gh-2928.js +++ b/test/sequential/test-http-regr-gh-2928.js @@ -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() { |