Browse Source

test: fix test-process-active-wraps.js

b636ba8186 caused a regression
on Windows due to the way server handles are cleaned up. This
commit fixes the test by allowing the handle to be cleaned up.

Fixes: https://github.com/joyent/node/issues/8986
PR-URL: https://github.com/joyent/node/pull/8998
Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
v0.11.15-release
cjihrig 10 years ago
parent
commit
1fad3730c2
  1. 10
      test/simple/test-process-active-wraps.js

10
test/simple/test-process-active-wraps.js

@ -49,7 +49,7 @@ var handles = [];
expect(1, 0); expect(1, 0);
var conn = net.createConnection(common.PORT); var conn = net.createConnection(common.PORT);
conn.on('lookup', onlookup); conn.on('lookup', onlookup);
conn.on('error', function() { assert(false); }); conn.on('error', function() { assert(false); });
expect(2, 1); expect(2, 1);
conn.destroy(); conn.destroy();
@ -65,8 +65,14 @@ var handles = [];
}); });
function onclose() { function onclose() {
if (++n === handles.length) { if (++n === handles.length) {
// Allow the server handle a few loop iterations to wind down.
// This test is highly dependent on the implementation of handle
// closing. If this test breaks in the future, it does not
// necessarily mean that Node is broken.
setImmediate(function() { setImmediate(function() {
assert.equal(process._getActiveHandles().length, 0); setImmediate(function() {
assert.equal(process._getActiveHandles().length, 0);
});
}); });
} }
} }

Loading…
Cancel
Save