-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
tests: remove common.PORT from cluster-worker-disconnect-on-error #12457
tests: remove common.PORT from cluster-worker-disconnect-on-error #12457
Conversation
Felt like this change warranted another pull request since it's not just an argument change. Please let me know if it can be improved. |
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.
Changes LGTM, although I'd change:
+ if (typeof msg.port != 'undefined') {
To assert that message.port is not undefined rather than ignore the message in that case and add a mustCall
assertion.
const worker = cluster.fork(); | ||
worker.send({port: server.address().port}); |
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.
I would send the port info in the listen()
callback
server.on('error', common.mustCall((e) => { | ||
cluster.worker.disconnect(); | ||
})); | ||
process.on('message', function(msg) { |
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.
I would wrap the callback with common.mustCall()
Remove common.PORT from test-cluster-worker-disconnect-on-error possibility that a dynamic port used in another test will collide with common.PORT. Refs: #12376
@benjamingr @santigimeno I made the requested changes. I hope I understood your suggestions. Please let me know how it looks. Thanks! |
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: #12457 Ref: #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]>
Landed in a2843f2 |
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: #12457 Ref: #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-worker-disconnect-on-error possibility that a dynamic port used in another test will collide with common.PORT. PR-URL: #12457 Ref: #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-worker-disconnect-on-error possibility that a dynamic port used in another test will collide with common.PORT. PR-URL: #12457 Ref: #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-worker-disconnect-on-error possibility that a dynamic port used in another test will collide with common.PORT. PR-URL: #12457 Ref: #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-worker-disconnect-on-error possibility that a dynamic port used in another test will collide with common.PORT. PR-URL: #12457 Ref: #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-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-worker-disconnect-on-error
possibility that a dynamic port used in another test will collide
with common.PORT.
Refs: #12376
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test