From b5c9dcb6d73d97eb2763e368c693da4a62b2f362 Mon Sep 17 00:00:00 2001 From: Colin Ihrig Date: Thu, 8 Jan 2015 20:42:41 +0100 Subject: [PATCH] win,test: fix test-process-active-wraps.js b636ba8 broke this test, because it now takes a loop iteration or two to resolve the loopback address. That consequence is that the TCPWrap handle that we *don't* want to see is created a bit later, and also destroyed later, so when we assert that the active handle list is empty the TCPWrap object is still "busy" being closed. Wait one extra loop iteration before checking there are no more active handles. This allows name resolution and clean-up to finish before the assertion. BUG: https://github.com/iojs/io.js/issues/246 PR-URL: https://github.com/joyent/node/pull/8998 Reviewed-By: Bert Belder --- test/parallel/test-process-active-wraps.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-process-active-wraps.js b/test/parallel/test-process-active-wraps.js index bd4941b786e735..05996b47efc6e6 100644 --- a/test/parallel/test-process-active-wraps.js +++ b/test/parallel/test-process-active-wraps.js @@ -49,7 +49,7 @@ var handles = []; expect(1, 0); var conn = net.createConnection(common.PORT); - conn.on('lookup', onlookup); + conn.on('lookup', onlookup); conn.on('error', function() { assert(false); }); expect(2, 1); conn.destroy(); @@ -65,8 +65,11 @@ var handles = []; }); function onclose() { if (++n === handles.length) { + // Allow the server handle a few loop iterations to wind down. setImmediate(function() { - assert.equal(process._getActiveHandles().length, 0); + setImmediate(function() { + assert.equal(process._getActiveHandles().length, 0); + }); }); } }