Refactor the message pass to the assert module in Test cluster setup master#16065
Refactor the message pass to the assert module in Test cluster setup master#16065jbeatj wants to merge 5 commits intonodejs:masterfrom
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.
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 |
| checks.setupEvent = true; | ||
|
|
||
| const settings = cluster.settings; | ||
| settings = cluster.settings; |
There was a problem hiding this comment.
Is this change actually needed at all?
There was a problem hiding this comment.
it's to be able to stringify the "settings" variable inside the assert message.
There was a problem hiding this comment.
@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.
@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.
@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)