-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: replace port in net immediate finish test #12996
Conversation
|
||
const client = net.connect({host: '***', port: common.PORT}); | ||
// port 8080 is hardcoded since this does not create a network connection | ||
const client = net.connect({host: '***', port: 8080}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good try, but IMHO it's too arbitrary, you could just use 0
.
A (controversial) other way is to copy what we did in 12964 but only do that as an exercise!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@refack Sounds good, I'll have the changes made in a quick update.
All done, updated the port to 0 (zero) and made the same update to the comment. |
I hate to say it, but I don’t think |
Does connecting to an invalid port raise an error? If so that might work well, that way if the connection does happen the test will fail. |
@arturgvieira after the long discussion we had in #12964 (also about a test that should immediately fail), I think best solution is to keep the use of Maybe next PR should actually merge this test with https://github.com/nodejs/node/blob/master/test/parallel/test-net-connect-local-error.js. that one tests for an error in the |
@refack Sounds good, I will revert the changes and move this test to sequential. |
@arturgvieira I just landed #12964 IMHO you can copy the old test code into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moving to /sequential/
|
||
const client = net.connect({host: '***', port: common.PORT}); | ||
// port 0 is hardcoded since this does not create a network connection | ||
const client = net.connect({host: '***', port: 0}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declare a const unfindable_host = '***'
All done, I replaced the host string literal with a constant, reverted the changes so that this test uses common.PORT and moved the test to sequential. |
@refack You want to merge this test with test/sequential/test-net-connect-local-error.js correct? |
Sounds good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to move this to sequential.
Replaced common.PORT in the following test. test-net-connect-immediate-finish.js Ref: #12376
Ok, I reverted that last change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Port 0
is not OK for this test for the reasons outlined by @addaleax.
I think this test may not need any changes at all. It's fine as is. The only change it might need is a comment explaining why using |
Sounds good. I'll close the PR, thanks for the review. |
Replaced common.PORT in the following test.
test-net-connect-immediate-finish.js
Ref: #12376
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test