-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
Conversation
Our test suite does not check when needPause becomes false. I add a test to improve coverage.
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 with some nits, good work!
'hightWaterMark'); | ||
return resume(...args); | ||
}); | ||
assert(!res.write(body), 'res.write must be fail because it will exceed ' + |
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.
I think this should be res.write must return false
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.
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); |
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.
can you add an assert here as well?
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.
I got it. I added a assertion.
const assert = require('assert'); | ||
const net = require('net'); | ||
const http = require('http'); | ||
|
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.
Can you add a description of the test here?
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.
Thank you for your review.
I added a description. Please check it again.
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, 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'); |
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.
s/hightWaterMark/highWaterMark
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.
Thank you for always review.
I'm sorry for my stupid mistake...
I fixed all typo.
server.close(); | ||
}); | ||
}) | ||
.listen(0); |
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.
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.
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.
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'); |
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.
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'); |
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.
s/hightWaterMark/highWaterMark
`res.write must be fail` to `res.write must return false`
Landed as a364e7e. |
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>
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>
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>
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>
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>
This PR closes #17051
@mcollina Would you please review my changes ?
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test