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

Add a test about socketOnDrain where needPause is false #17654

Closed
wants to merge 6 commits into from
Closed

Add a test about socketOnDrain where needPause is false #17654

wants to merge 6 commits into from

Conversation

Leko
Copy link
Contributor

@Leko Leko commented Dec 13, 2017

This PR closes #17051

@mcollina Would you please review my changes ?

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

Our test suite does not check when needPause becomes false.
I add a test to improve coverage.
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Dec 13, 2017
Copy link
Member

@mcollina mcollina left a 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, good work!

'hightWaterMark');
return resume(...args);
});
assert(!res.write(body), 'res.write must be fail because it will exceed ' +
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be res.write must return false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I got it. I updated error message.

assert(req.connection._paused, '_paused must be true because it exceeds' +
'hightWaterMark by second request');
}));
res.write(body);
Copy link
Member

Choose a reason for hiding this comment

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

can you add an assert here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I got it. I added a assertion.

const assert = require('assert');
const net = require('net');
const http = require('http');

Copy link
Member

Choose a reason for hiding this comment

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

Can you add a description of the test here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your review.
I added a description. Please check it again.

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, just some nits

// Case of needParse = false
req.connection.once('pause', common.mustCall(() => {
assert(req.connection._paused, '_paused must be true because it exceeds' +
'hightWaterMark by second request');
Copy link
Member

Choose a reason for hiding this comment

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

s/hightWaterMark/highWaterMark

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for always review.
I'm sorry for my stupid mistake...
I fixed all typo.

server.close();
});
})
.listen(0);
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 go on the previous line or just be its own server.listen(0); statement? It's a bit awkward to follow right now due to the lack of indentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I got it.
I split statement as }); and server.listen(0);.

return resume(...args);
});
assert(!res.write(body), 'res.write must be fail because it will exceed ' +
'hightWaterMark on this call');
Copy link
Member

Choose a reason for hiding this comment

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

s/hightWaterMark/highWaterMark

const paused = req.connection._paused;
assert(!paused, '_paused must be false because it become false by ' +
'socketOnDrain when outgoingData falls below ' +
'hightWaterMark');
Copy link
Member

Choose a reason for hiding this comment

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

s/hightWaterMark/highWaterMark

@mcollina
Copy link
Member

@mcollina
Copy link
Member

Landed as a364e7e.

@mcollina mcollina closed this Dec 15, 2017
mcollina pushed a commit that referenced this pull request Dec 15, 2017
Adds a tests that checks if we can start reading again
from a socket backing an incoming http request.

PR-URL: #17654
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
@Leko Leko deleted the test_http_socketondrain branch December 16, 2017 09:15
MylesBorins pushed a commit that referenced this pull request Jan 8, 2018
Adds a tests that checks if we can start reading again
from a socket backing an incoming http request.

PR-URL: #17654
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
MylesBorins pushed a commit that referenced this pull request Jan 9, 2018
Adds a tests that checks if we can start reading again
from a socket backing an incoming http request.

PR-URL: #17654
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
@MylesBorins MylesBorins mentioned this pull request Jan 10, 2018
MylesBorins pushed a commit that referenced this pull request Jan 23, 2018
Adds a tests that checks if we can start reading again
from a socket backing an incoming http request.

PR-URL: #17654
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
gibfahn pushed a commit that referenced this pull request Jan 24, 2018
Adds a tests that checks if we can start reading again
from a socket backing an incoming http request.

PR-URL: #17654
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
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.

http: Add coverage for socketOnDrain and updateOngoingData
5 participants