Skip to content
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

test: update test-http-timeout-overflow to use common.mustCall #17528

Closed
wants to merge 2 commits into from

Conversation

collin5
Copy link
Contributor

@collin5 collin5 commented Dec 7, 2017

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

Updated tests in /test/parallel/test-http-timeout-overflow.js to use Countdown module.

Ref issue #17169

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Dec 7, 2017
Copy link
Member

@apapirovski apapirovski left a 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) {
Copy link
Member

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.

Copy link
Contributor Author

@collin5 collin5 Dec 8, 2017

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() {
Copy link
Member

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 */ }).

@collin5
Copy link
Contributor Author

collin5 commented Dec 8, 2017

@apapirovski Thanks for the feedback, I've pushed the changes 👍.
I've also realized that this also applies to some of the tests we have in this list. I think adding info of what tests should use common.mustCall over the Countdown module may be a good idea.

Copy link
Member

@apapirovski apapirovski left a 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!

@apapirovski
Copy link
Member

@apapirovski apapirovski changed the title test: update test-http-timeout-overflow to use countdown timer test: update test-http-timeout-overflow to use common.mustCall Dec 8, 2017
@apapirovski
Copy link
Member

Landed in d2626ef. Thank you for your contribution, @collin5, and congrats on becoming a Contributor! 🎉

@apapirovski apapirovski closed this Dec 9, 2017
apapirovski pushed a commit that referenced this pull request Dec 9, 2017
PR-URL: #17528
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
@collin5
Copy link
Contributor Author

collin5 commented Dec 9, 2017

@apapirovski Thank you too 👍

@collin5 collin5 deleted the fix-issue-17169 branch December 9, 2017 21:04
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
PR-URL: #17528
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
PR-URL: #17528
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
@MylesBorins MylesBorins mentioned this pull request Dec 12, 2017
gibfahn pushed a commit that referenced this pull request Dec 20, 2017
PR-URL: #17528
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
@gibfahn gibfahn mentioned this pull request Dec 20, 2017
gibfahn pushed a commit that referenced this pull request Dec 20, 2017
PR-URL: #17528
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
@gibfahn gibfahn mentioned this pull request Dec 20, 2017
gibfahn pushed a commit that referenced this pull request Dec 20, 2017
PR-URL: #17528
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants