-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
test: update test-http-timeout-overflow to use common.mustCall #17528
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.
Hi @collin5 — thank you for taking this on! this particular test would be better with using common.mustCall
for both the function
within http.createServer
and within res.on('end')
. Then the process.on('exit')
block can also be removed.
Countdown is better when used for tests where n > 1
.
const serverReqCountdown = new Countdown(1, () => { | ||
response.writeHead(200, { 'Content-Type': 'text/plain' }); | ||
response.end('OK'); | ||
}); | ||
|
||
const server = http.createServer(function(req, res) { |
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.
This could be common.mustCall(function(req, res) { /* function body */ })
which would then confirm that it executes during the duration of the test. Then no Countdown is needed.
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.
@apapirovski Right, that actually makes more sense. Let me do it ASAP 👍
@@ -45,8 +50,7 @@ server.listen(0, function() { | |||
req.clearTimeout(callback); | |||
|
|||
res.on('end', function() { |
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.
This can also use common.mustCall
so common.mustCall(function() { /* function body */ })
.
@apapirovski Thanks for the feedback, I've pushed the changes 👍. |
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. Thanks for making the changes!
PR-URL: #17528 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
@apapirovski Thank you too 👍 |
PR-URL: #17528 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
PR-URL: #17528 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
PR-URL: #17528 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
PR-URL: #17528 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
PR-URL: #17528 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
Updated tests in /test/parallel/test-http-timeout-overflow.js to use Countdown module.
Ref issue #17169