-
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
Refactor test http exceptions #18506
Conversation
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.
LGTM with some nits
test/common/README.md
Outdated
@@ -380,7 +380,8 @@ Synchronous version of `spawnPwd`. | |||
The `Countdown` module provides a simple countdown mechanism for tests that | |||
require a particular action to be taken after a given number of completed | |||
tasks (for instance, shutting down an HTTP server after a specific number of | |||
requests). | |||
requests). Note that _the Countdown will fail the test if the remainder | |||
did not reach 0_. |
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 italics aren't necessary here, IMO.
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 go so far and remove the Note that
as well.
|
||
process.on('uncaughtException', | ||
common.mustCall(onUncaughtException, NUMBER_OF_EXCEPTIONS) | ||
); |
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.
Can this be brought up to the previous line? The dangling );
is awkward.
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.
sadly it cant be moved up since it will break the linter due to reaching the max limit of 80 characters in one 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.
It's only 70 chars as far as I can tell?
const http = require('http'); | ||
const NUMBER_OF_EXCEPTIONS = 4; | ||
const countdown = new Countdown(NUMBER_OF_EXCEPTIONS, () => { | ||
process.exit(0); |
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.
Does server.close()
not do the trick here?
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 does not, probably because of the intended exception throwing intentionally_not_defined
. it keeps res
from being closed with .end();
.
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.
LGTM with the comments addressed.
test/common/README.md
Outdated
@@ -380,7 +380,8 @@ Synchronous version of `spawnPwd`. | |||
The `Countdown` module provides a simple countdown mechanism for tests that | |||
require a particular action to be taken after a given number of completed | |||
tasks (for instance, shutting down an HTTP server after a specific number of | |||
requests). | |||
requests). Note that _the Countdown will fail the test if the remainder | |||
did not reach 0_. |
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 go so far and remove the Note that
as well.
@BridgeAR @apapirovski updated as per feedback |
@BridgeAR can you explain why is this failing? how can i solve it? seems like a rebase issue or something, should i rebase commits into one commit? |
@Bamieh there is a merge commit in here. Please rebase and force push with lease. The CI is not able to rebase this otherwise. |
6abfde3
to
c5b6e69
Compare
@BridgeAR Thanks! I believe i did what is needed. can you re-run the CI? |
@Bamieh it looks like this has a typo in one of the test files. Could you fix and then I'll start another CI? |
@apapirovski im getting this error:
This has nothing to do with my change, and i am upto date with master. Any idea? this PR has been rough for some reason :/ Also the tests were passing before I merge master a few days ago. Running
|
remove typo
c5b6e69
to
6840cf3
Compare
Should i run
|
@BridgeAR
in https://ci.nodejs.org/job/node-test-commit-linux/nodes=fedora24/16264/console Is this something caused by me? should i rebase again or something? |
@Bamieh the current failures are infrastructure related and have nothing to do with this PR. So you do not have to worry about anything :-) |
} | ||
|
||
process.on('uncaughtException', | ||
common.mustCall(onUncaughtException, NUMBER_OF_EXCEPTIONS)); |
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.
Nit, the common.mustCall
is obsolete here, because the test will not execute countdown.dec()
in case it would not be called and would then fail because the wrapper around the countdown would fail.
This adds a implicit common.mustCall to the callback provided to the countdown. PR-URL: nodejs#18506 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
Landed in 941bc93 🎉 I addressed the nit while landing. |
This adds a implicit common.mustCall to the callback provided to the countdown. PR-URL: #18506 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
This adds a implicit common.mustCall to the callback provided to the countdown. PR-URL: #18506 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
This adds a implicit common.mustCall to the callback provided to the countdown. PR-URL: nodejs#18506 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
This adds a implicit common.mustCall to the callback provided to the countdown. PR-URL: #18506 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
This adds a implicit common.mustCall to the callback provided to the countdown. PR-URL: #18506 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
This adds a implicit common.mustCall to the callback provided to the countdown. PR-URL: #18506 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
This adds a implicit common.mustCall to the callback provided to the countdown. PR-URL: #18506 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
Reopens: #17199
I had a busy schedule so i was not able to rebase and the PR was closed. The PR was approved but needed a rebase with master due to some conflicts in which i resolved in this PR.
test-http-exceptions
to use countdown, as per issue [Tracking issue] Converting tests to use Countdown #17169common.mustCall
to thecountdown
callback, since the user will always want this function to be called, and it must fail if the user fails to decrease the counter to 0.common.mustCall
functions around theCountdown
callbacks in all the tests.countdown
to test that a mustCall is in place.common.md
docs to inform thecountdown
users that the test will fail if the countdown callback was not called.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test