Uh oh!
There was an error while loading. Please reload this page.
test: use 443, not common.PORT - #14928
Conversation
tniessen
commented
Aug 18, 2017
Trott
left a comment
There was a problem hiding this comment.
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.
maclover7
commented
Aug 18, 2017
Agree, will do
Isn't the point here to migrate away from |
Trott
commented
Aug 19, 2017
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 |
maclover7
commented
Aug 19, 2017
@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 |
Trott
commented
Aug 19, 2017
jasnell
commented
Aug 23, 2017
Actually... thinking twice about this one... should the test use a commonly used hardcoded port? |
Trott
commented
Aug 23, 2017
@jasnell I think you're right. I think lines 40-44 can all be replaced with a single line: assert.throws(tls.connect,Done); |
maclover7
commented
Aug 24, 2017
I think it's still necessary because that makes sure that the function threw because of |
Trott
commented
Aug 24, 2017
jasnell
commented
Aug 24, 2017
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