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: increase coverage of _http_outgoing #10820

Conversation

hiroppy
Copy link
Member

@hiroppy hiroppy commented Jan 15, 2017

validateHeader: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L376
write: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L477
addTrailers: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L557

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 test Issues and PRs related to the tests. lts-watch-v6.x labels Jan 15, 2017
Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

Very close. Almost there.

@@ -12,3 +12,63 @@ assert.strictEqual(
typeof ClientRequest.prototype._implicitHeader, 'function');
assert.strictEqual(
typeof ServerResponse.prototype._implicitHeader, 'function');

// validateHeader
assert.throws(common.mustCall(() => {
Copy link
Member

Choose a reason for hiding this comment

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

There's no need to use common.mustCall() on functions passed to assert.throws()

}), /^TypeError: Header name must be a valid HTTP Token \["undefined"\]$/);

assert.throws(common.mustCall(() => {
const outgoingMessage = new OutgoingMessage();
Copy link
Member

Choose a reason for hiding this comment

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

To make the test more efficient, why not create a single top level outgoingMessage instance, each of the tests can just reuse it

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure that's a good idea in this case, as the tests would be sharing state unnecessarily.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree with @cjihrig's idea.

@mscdex mscdex added the http Issues or PRs related to the http subsystem. label Jan 15, 2017
Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

LGTM once the common.mustCall()s are dropped.

@hiroppy hiroppy force-pushed the feature/add-tests-to-test-http-outgoing-proto.js branch from b04af19 to d4aaade Compare January 15, 2017 23:37
@hiroppy
Copy link
Member Author

hiroppy commented Jan 15, 2017

Deleted common.mustCall().

@jasnell
Copy link
Member

jasnell commented Jan 18, 2017

@targos
Copy link
Member

targos commented Jan 22, 2017

Landed in 02ccffb. Thank you!

@targos targos closed this Jan 22, 2017
targos pushed a commit that referenced this pull request Jan 22, 2017
validateHeader: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L376
write: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L477
addTrailers: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L557

PR-URL: #10820
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
@hiroppy hiroppy deleted the feature/add-tests-to-test-http-outgoing-proto.js branch January 23, 2017 05:05
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 25, 2017
validateHeader: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L376
write: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L477
addTrailers: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L557

PR-URL: nodejs#10820
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 27, 2017
validateHeader: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L376
write: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L477
addTrailers: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L557

PR-URL: nodejs#10820
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
@italoacasas italoacasas mentioned this pull request Jan 29, 2017
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
validateHeader: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L376
write: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L477
addTrailers: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L557

PR-URL: nodejs#10820
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
validateHeader: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L376
write: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L477
addTrailers: https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js#L557

PR-URL: nodejs#10820
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
@MylesBorins
Copy link
Contributor

This does not land cleanly in LTS. Added dont-land label. Please feel free to manually backport

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.

7 participants