-
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
Remove common.PORT
usage from parallel
tests
#12376
Comments
Maybe update the description of |
For a few of these, (test-net-better-error-messages-*) they don't actually have a server, they try to connect to a server that is not running. Are those ones that you think we should still change @Trott? |
@evanlucas @richardlau I would love to contribute to this one, but I don't feel comfortable doing so. Can I count on you to guide me on my first contributions? Anything I should read on OS port attribution? |
So we are slowly removing |
Remove common.PORT from test-cluster-dgram-reuse to eliminate possibility that a dynamic port used in another test will collide with common.PORT. Refs: nodejs#12376
@rafaelfragosom go for it! You should have plenty of people willing to help you if you have any issues (count me in). |
@gibfahn I'm making progress so far. Thank you! |
@thefourtheye From tests in Once we get |
@rafaelfragosom no not at all. The general rule (see CONTRIBUTING.md) is one commit per logical change. If you're doing basically the same thing to 20 files, that's one commit. You can also have multiple commits per PR. My general rule is one PR per easily reviewed thing. EDIT: In fact loads of very similar PRs can get pretty exhausting for reviewers as well. |
@gibfahn Awesome! I'm trying to wrap my head inside the tests, specially from clusters, and what's bothering me right now is how common.PORT is being used, like the issue says. I wasn't here when these tests were written so I don't know what I'm saying but, isn't it better to write a What are your thoughts on this? I'm currently looking at // ...
if (cluster.isWorker) {
net.createServer((socket) => {
socket.end('echo');
}).listen(common.PORT, '127.0.0.1');
net.createServer((socket) => {
socket.end('echo');
}).listen(common.PORT + 1, '127.0.0.1');
// ... And could be probably written like this: // ...
if (cluster.isWorker) {
var port = common.getAvailablePortSync();
net.createServer((socket) => {
socket.end('echo');
}).listen(port, '127.0.0.1');
net.createServer((socket) => {
socket.end('echo');
}).listen(port + 1, '127.0.0.1');
// ... I'm really excited for this next PR, this is the last test on Thank you. |
Just playing devil's advocate. There is a remote possibility that the port is already chosen by the OS. |
Yes, that's always a possibility. I agree it's best to avoid |
I imagine it was taken into account but we have to be sure that we're not removing coverage for the case when a method is called with a specific port. |
@rafaelfragosom I would suggest doing something like #12418 (using The problem with getting a free port through something like cc/ @Trott as there might be a better solution. |
Yup, absolutely, good to make that explicit for sure. |
The usage of common.PORT could cause undesired port collisions when run in parallel. The following test was moved to sequential. test-net-reconnect-error.js PR-URL: #13033 Refs: #12376 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
Replace common.PORT with available port assigned by the operating system in test-dgram-send-callback-buffer. PR-URL: #12942 Refs: #12376 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Remove common.PORT from test-dgram-send-callback-buffer-length to eliminate possibility that a dynamic port used in another test will collide with common.PORT. PR-URL: #12943 Refs: #12376 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Remove common.PORT from test-cluster-worker-disconnect, test-cluster-worker-exit and test-cluster-worker-kill to eliminate the possibility that a dynamic port used in another test will collide with common.PORT. PR-URL: nodejs/node#12443 Ref: nodejs/node#12376 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs/node#12441 Ref: nodejs/node#12376 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Remove common.PORT from test-cluster-bind-twice to eliminate possibility that a dynamic port used in another test will collide with common.PORT. PR-URL: nodejs/node#12418 Ref: nodejs/node#12376 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
Remove common.PORT from test-cluster-send-deadlock and test-cluster-send-handle-twice to reduce possibility that a dynamic port used in another test will collide with common.PORT. PR-URL: nodejs/node#12472 Ref: nodejs/node#12376 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
Change common.PORT to '0' to avoid the possibility of getting EADDRINUSE error if another test in 'parallel' uses port '0' at the same time. PR-URL: nodejs/node#12461 Ref: nodejs/node#12376 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
Remove common.PORT from test-cluster-worker-disconnect-on-error possibility that a dynamic port used in another test will collide with common.PORT. PR-URL: nodejs/node#12457 Ref: nodejs/node#12376 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]>
Remove common.PORT from test-cluster-dgram-1 and test-cluster-dgram-2, in order to eliminate the possibility of port collision. PR-URL: nodejs/node#12487 Ref: nodejs/node#12376 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]>
Removed common.PORT from test-cluster-message, test-cluster-server-restart-none, test-cluster-server-restart-rr and test-cluster-shared-handle-bind-error to eliminate the possibility that a dynamic port used in another test will collide with common.PORT. PR-URL: nodejs/node#12584 Ref: nodejs/node#12376 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
Removed common.PORT from test-cluster-ipc-throw to eliminate the possibility that a dynamic port used in another test will collide with common.PORT. PR-URL: nodejs/node#12571 Ref: nodejs/node#12376 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
Removed common.PORT from test-cluster-eaddrinuse to eliminate the possibility that a dynamic port used in another test will collide with common.PORT. PR-URL: nodejs/node#12547 Ref: nodejs/node#12376 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
Change common.PORT to dynamic port to prevent collision with other parallel test which use common.PORT Refs: [nodejs#12376](nodejs#12376)
A bunch more of the test files from the big list above have been completed (purposefully not putting test/parallel/test-cluster-disconnect.js, 12545 |
Thanks, @maclover7! I've updated the list. |
PR-URL: #14928 Ref: #12376 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: nodejs/node#14928 Ref: nodejs/node#12376 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: nodejs/node#14928 Ref: nodejs/node#12376 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #14928 Ref: #12376 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #14928 Ref: #12376 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
PR-URL: #14928 Ref: #12376 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
Tests in
parallel
that usecommon.PORT
risk gettingEADDRINUSE
if another test inparallel
uses port0
(to get an open port assigned by the operating system) at the same time the test runs. This appears to have happened recently. (See #12363 (comment).)IMO, all instances of
common.PORT
inparallel
should either be changed to use port0
(if possible in the context of the test) or else moved tosequential
(if using port0
is not possible).Here are the current tests that use
common.PORT
:parallel
tests #12473)parallel
tests #12473)The text was updated successfully, but these errors were encountered: