-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: use 443, not common.PORT #14928
Conversation
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.
Hmmm.... Using 0
for connect()
doesn't make semantic sense. It's more likely to be a distraction than anything else. These things are throwing/emitting errors before they connect, right to anything, right? Using 0
runs the risk of it appearing that port 0 is the error-causing thing in the test and not the invalid host or whatever. For the TLS client, maybe just use port 443
because that's the usual port for such things so it shouldn't raise any attention? For the net
test, any valid port should be fine. common.PORT
is A-OK, or you can change it to 80
or 443
or 8080
or whatever.
Agree, will do
Isn't the point here to migrate away from |
Almost, but not quite. The point here is to avoid port collisions between tests that use port The easiest way to do that is to avoid listening to or connecting to If I understand these tests correctly, in both of these cases, the So, since any valid port will do as a placeholder and no actual connection occurs in these function calls (because they throw/emit errors), * For example, if one test uses |
@Trott updated -- thank you for your time walking me through this and for the great discussion! Was a little bit hard to understand the tests at first. I removed |
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.
LGTM
Actually... thinking twice about this one... should the test use a commonly used hardcoded port? |
@jasnell I think you're right. I think lines 40-44 can all be replaced with a single line: assert.throws(tls.connect, Done); |
I think it's still necessary because that makes sure that the function threw because of |
Landed in d86eb5c |
PR-URL: nodejs/node#14928 Ref: nodejs/node#12376 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: nodejs/node#14928 Ref: nodejs/node#12376 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Ref: #12376
cc @Trott
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test