Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

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

Merged
merged 1 commit into from
Jan 8, 2015
Merged

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

merged 1 commit into from
Jan 8, 2015

Conversation

cjihrig
Copy link

@cjihrig cjihrig commented Jan 8, 2015

b636ba8 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. Closes #8986.

cc: @piscisaureus @misterdjules

cjihrig added a commit to nodejs/node that referenced this pull request Jan 8, 2015
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: #246
PR-URL: nodejs/node-v0.x-archive#8998
Reviewed-By: Bert Belder <bertbelder@gmail.com>
@piscisaureus
Copy link

LGTM, landed in nodejs/node@b5c9dcb

setImmediate(function() {
assert.equal(process._getActiveHandles().length, 0);
});
// give server handle a chance to close - see GH #8986

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we could add to this comment (or at the beginning of this file, as a general comment) that this test depends a lot on the implementation of how handles are closed, and as such can and will likely break in the future?

We could add a note saying that if the test breaks, it may be because of a correct change in the way handles are closed, and it doesn't necessarily mean that node is broken.

It may save us some time next time this test breaks.

@misterdjules
Copy link

@cjihrig Except for my inline comment, LGTM.

@misterdjules misterdjules added this to the 0.11.15 milestone Jan 8, 2015
b636ba8 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.
@cjihrig cjihrig merged commit d4bf35f into nodejs:v0.12 Jan 8, 2015
@cjihrig cjihrig deleted the test-hack branch January 8, 2015 23:40
cjihrig added a commit that referenced this pull request Jan 8, 2015
b636ba8 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: #8986
PR-URL: #8998
Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
@cjihrig
Copy link
Author

cjihrig commented Jan 8, 2015

Thanks! @misterdjules I updated the comment as you asked. Landed in 1fad373

@misterdjules
Copy link

@cjihrig @piscisaureus Thanks you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants