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

refactor : test-http-request-dont-override-options to use common.mustCall #17438

Closed
wants to merge 1 commit into from
Closed

Conversation

mithunsasidharan
Copy link
Contributor

@mithunsasidharan mithunsasidharan commented Dec 3, 2017

refactor : test-http-request-dont-override-options to use common.mustCall as per issue #17169

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Dec 3, 2017
@mithunsasidharan mithunsasidharan changed the title test : refactored test cases in test-http-request-dont-override-options to use countdown test : refactored test-http-request-dont-override-options to use countdown Dec 3, 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.

This should be refactored to use common.mustCall instead of Countdown since it's supposed to only run 1 request anyway.

(I don't think the changes here are correct since the countdown never goes to 0.)

@mscdex mscdex added the http Issues or PRs related to the http subsystem. label Dec 3, 2017
@mithunsasidharan mithunsasidharan changed the title test : refactored test-http-request-dont-override-options to use countdown refactor : test-http-request-dont-override-options to use common.mustCall Dec 3, 2017
@mithunsasidharan
Copy link
Contributor Author

@apapirovski : Thanks for the feedback. I've updated the PR to include the recommended changes. Kindly review the PR now.


http.createServer(function(req, res) {
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.

common.mustCall should be added to this function.

}).listen(0, function() {
server.listen(0);

server.on('listening', common.mustCall(function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to call on here since listen (line 13) accepts a callback.

@@ -33,13 +34,11 @@ http.createServer(function(req, res) {
}).end();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could just put server.close() after res.resume() and then validate the assert conditions there (lines 37-42). That way we don't need the process.on('exit').

assert.strictEqual(options.host, undefined);
assert.strictEqual(options.hostname, common.localhostIPv4);
assert.strictEqual(options.port, undefined);
assert.strictEqual(options.defaultPort, undefined);
assert.strictEqual(options.path, undefined);
assert.strictEqual(options.method, undefined);
});
}).unref();
})).unref();
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 be removed if server.close() is added somewhere as per above.

@mithunsasidharan
Copy link
Contributor Author

@apapirovski : Thanks for the feedback. I've updated the PR addressing the review comments. Kindly review the PR. Thanks!

}).listen(0, function() {
server.listen(0, nextTest);

function nextTest() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be just inlined above? The name isn't very descriptive (and could confuse someone in the future) since there's only 1 test, not many.

server.listen(0, () => {...});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@apapirovski : Thanks for the feedback. I've updated the PR as per the comment and also shortened the commit message. Kindly review the PR now. Thanks !

@apapirovski
Copy link
Member

@maclover7 maclover7 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 5, 2017
@maclover7
Copy link
Contributor

Landing...

@maclover7 maclover7 self-assigned this Dec 6, 2017
@maclover7
Copy link
Contributor

Landed in 00c5b06

@maclover7 maclover7 closed this Dec 6, 2017
maclover7 pushed a commit to maclover7/node that referenced this pull request Dec 6, 2017
…stCall

PR-URL: nodejs#17438
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@addaleax addaleax removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 7, 2017
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
…stCall

PR-URL: #17438
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
…stCall

PR-URL: #17438
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Dec 12, 2017
gibfahn pushed a commit that referenced this pull request Dec 20, 2017
…stCall

PR-URL: #17438
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
gibfahn pushed a commit that referenced this pull request Dec 20, 2017
…stCall

PR-URL: #17438
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@gibfahn gibfahn mentioned this pull request Dec 20, 2017
gibfahn pushed a commit that referenced this pull request Dec 20, 2017
…stCall

PR-URL: #17438
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@gibfahn gibfahn mentioned this pull request Dec 20, 2017
@MylesBorins MylesBorins mentioned this pull request Dec 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http Issues or PRs related to the http subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants