From 5ba307a97879342ff81aa813ffd7da46b6411b1c Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 23 Jan 2015 17:11:14 +0100 Subject: [PATCH 1/3] test: fix parallel/test-dgram-error-message-address The test expects EADDRNOTAVAIL when trying to bind to address 111::1. Systems that have IPv6 disabled throw EAFNOSUPPORT instead, however. Update the test accordingly. PR-URL: https://github.com/iojs/io.js/pull/575 Reviewed-By: Colin Ihrig Reviewed-By: Fedor Indutny --- test/parallel/test-dgram-error-message-address.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-dgram-error-message-address.js b/test/parallel/test-dgram-error-message-address.js index 7842203d80c6c5..f66e86b778ab0b 100644 --- a/test/parallel/test-dgram-error-message-address.js +++ b/test/parallel/test-dgram-error-message-address.js @@ -24,10 +24,12 @@ var family_ipv6 = 'IPv6'; socket_ipv6.on('listening', assert.fail); socket_ipv6.on('error', common.mustCall(function(e) { - assert.equal(e.message, 'bind EADDRNOTAVAIL 111::1:' + common.PORT); + // EAFNOSUPPORT means IPv6 is disabled on this system. + var code = (e.code === 'EADDRNOTAVAIL' ? e.code : 'EAFNOSUPPORT'); + assert.equal(e.message, 'bind ' + code + ' 111::1:' + common.PORT); assert.equal(e.address, '111::1'); assert.equal(e.port, common.PORT); - assert.equal(e.code, 'EADDRNOTAVAIL'); + assert.equal(e.code, code); socket_ipv6.close(); })); From 4f95b5d8253ef64e3673b9fa178c41dc8109b72b Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 23 Jan 2015 17:14:36 +0100 Subject: [PATCH 2/3] test: fix parallel/test-http-destroyed-socket-write2 Ameliorate a timing sensitivity issue by switching from setImmediate() to setTimeout() with a 50 ms timeout. This commit also adds EPIPE as an accepted error (besides ECONNABORT and ECONNRESET) because that's a plausible outcome given the timing sensitive nature of test. PR-URL: https://github.com/iojs/io.js/pull/575 Reviewed-By: Colin Ihrig Reviewed-By: Fedor Indutny --- test/parallel/test-http-destroyed-socket-write2.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http-destroyed-socket-write2.js b/test/parallel/test-http-destroyed-socket-write2.js index dc5b129dc89c1e..1552d2c2c1297e 100644 --- a/test/parallel/test-http-destroyed-socket-write2.js +++ b/test/parallel/test-http-destroyed-socket-write2.js @@ -19,7 +19,7 @@ server.listen(common.PORT, function() { method: 'POST' }); - var timer = setImmediate(write); + var timer = setTimeout(write, 50); var writes = 0; function write() { @@ -28,7 +28,7 @@ server.listen(common.PORT, function() { req.end(); test(); } else { - timer = setImmediate(write); + timer = setTimeout(write, 50); req.write('hello'); } } @@ -45,6 +45,9 @@ server.listen(common.PORT, function() { case 'ECONNRESET': // On windows this sometimes manifests as ECONNABORTED case 'ECONNABORTED': + // This test is timing sensitive so an EPIPE is not out of the question. + // It should be infrequent, given the 50 ms timeout, but not impossible. + case 'EPIPE': break; default: assert.strictEqual(er.code, From 3143d732f6efd82da76e9c53ad192ac14071bf70 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 23 Jan 2015 17:31:48 +0100 Subject: [PATCH 3/3] test: delete parallel/test-process-active-wraps It is supposed to test an internal debug feature but what it effectively ends up testing, is the exact lifecyle of different kinds of internal handles. Lifecycles are different across releases and platforms, making the test fail intermittently or, in some environments, consistently. It's not a good test, delete it. PR-URL: https://github.com/iojs/io.js/pull/575 Reviewed-By: Colin Ihrig Reviewed-By: Fedor Indutny --- test/parallel/test-process-active-wraps.js | 55 ---------------------- 1 file changed, 55 deletions(-) delete mode 100644 test/parallel/test-process-active-wraps.js diff --git a/test/parallel/test-process-active-wraps.js b/test/parallel/test-process-active-wraps.js deleted file mode 100644 index 6b1313b41aec5f..00000000000000 --- a/test/parallel/test-process-active-wraps.js +++ /dev/null @@ -1,55 +0,0 @@ -var common = require('../common'); -var assert = require('assert'); -var spawn = require('child_process').spawn; -var net = require('net'); - -function expect(activeHandles, activeRequests) { - assert.equal(process._getActiveHandles().length, activeHandles); - assert.equal(process._getActiveRequests().length, activeRequests); -} - -var handles = []; - -(function() { - expect(0, 0); - var server = net.createServer().listen(common.PORT); - expect(1, 0); - server.close(); - expect(1, 0); // server handle doesn't shut down until next tick - handles.push(server); -})(); - -(function() { - function onlookup() { - setImmediate(function() { - assert.equal(process._getActiveRequests().length, 0); - }); - }; - - expect(1, 0); - var conn = net.createConnection(common.PORT); - conn.on('lookup', onlookup); - conn.on('error', function() { assert(false); }); - expect(2, 1); - conn.destroy(); - expect(2, 1); // client handle doesn't shut down until next tick - handles.push(conn); -})(); - -(function() { - var n = 0; - - handles.forEach(function(handle) { - handle.once('close', onclose); - }); - function onclose() { - if (++n === handles.length) { - // Allow the server handle a few loop iterations to wind down. - setImmediate(function() { - setImmediate(function() { - assert.equal(process._getActiveHandles().length, 0); - }); - }); - } - } -})();