-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Refactor the message pass to the assert module in Test cluster setup master #16065
Conversation
This reverts commit ecf7a1778564b5d66b88b19d5653868cb0508286.
- The assert "assert.ok(checks.workers, 'Not all workers went online');" was remove, instead, mustCall was add around the callback that is called after a worker get online. So you don't have to do something like : "onlineWorker ++ , if onlineWorker == totalWorker". - The assert that make sure if all the worker got their arguments got his message refactor so that it include the number of worker that got argument vs the expected number of argument. - The assert that check if the setting object have his properties fill got his message refactor, it now print the content of the setting object.
assert.ok(checks.workers, 'Not all workers went online'); | ||
assert.ok(checks.args, 'The arguments was noy send to the worker'); | ||
const argsMsg = `The arguments was not send for one or more worker. | ||
There was ${correctInput} worker that receive |
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.
The indentations will be preserved when they show up in assertions. Can you change this to using concatenations instead?
@joyeecheung I change the indentation for concatenation |
@@ -49,7 +49,7 @@ if (cluster.isWorker) { | |||
cluster.once('setup', function() { | |||
checks.setupEvent = true; | |||
|
|||
const settings = cluster.settings; | |||
settings = cluster.settings; |
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.
Is this change actually needed at all?
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 to be able to stringify the "settings" variable inside the assert message.
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.
@BridgeAR Hey, just wanna be sure about "This effects the test subsystem and the commit message do not follow the guidelines that are linked when opening a PR. It would be nice if this could be fixed." you want me to rewrite each commit message to make sure they follow the guide line ?!
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.
@jbeatj If you are comfortable with git, you can do a git rebase master -i
and squash all the commits with one left as something like test: improve the assertion message
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.
@jbeatj Also you can leave this to whoever lands this and they would do that for you.
This effects the test subsystem and the commit message do not follow the guidelines that are linked when opening a PR. It would be nice if this could be fixed. |
Landed in e8a2438, thanks for the contribution! |
- use mustCall instead of counters - include totalWorkers and settings in the error messages PR-URL: #16065 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
- use mustCall instead of counters - include totalWorkers and settings in the error messages PR-URL: nodejs/node#16065 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
- use mustCall instead of counters - include totalWorkers and settings in the error messages PR-URL: #16065 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
- use mustCall instead of counters - include totalWorkers and settings in the error messages PR-URL: #16065 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
- use mustCall instead of counters - include totalWorkers and settings in the error messages PR-URL: #16065 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
- use mustCall instead of counters - include totalWorkers and settings in the error messages PR-URL: #16065 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
In test/parallel/test-cluster-setup-master.js, a refactoring was done on the message pass to the assert module. Template literal was add in some case to give more information. Also, one assert was remove because the test was optimize by adding the "must call method" from common. Rather than incrementing a variable each time a worker go online and then assert that this number is equal to totalWorker. We specify that the callback after the worker get online are call totalWorker times with the "mustcall" method from common.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)