You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
stream, test: add tests for _readableStream.awaitDrain #8684
I have made a proposal how this state variable can be tested in PR #8914 .
As we already have some tests for awaitDrain - I think it's better to add some asserts to them for covering real awairDrain value.
Also tests now cover reseting awaitDrain counter.
But I don't understand what this test is doing and can't rewrite it correctly. Can you someone help me with that?
@mcollina great. will add some more tests for manual-resume. But I think this comment
// First pause, resume manually. The next write() to writable will still
// return false, because chunks are still being buffered, so it will increase
// the awaitDrain counter again.
is a bit strange at the place "increase again".
As we have only one writer here - the counter can't be increased more than one time.
So probably I will change that comment.
Activity
shmuga commentedon Oct 3, 2016
I have made a proposal how this state variable can be tested in PR #8914 .
As we already have some tests for awaitDrain - I think it's better to add some asserts to them for covering real awairDrain value.
Also tests now cover reseting awaitDrain counter.
But I don't understand what this test is doing and can't rewrite it correctly. Can you someone help me with that?
mcollina commentedon Oct 3, 2016
@shmuga yes, good job!
The test you mentioned is increasing the awaitDrain mechanism manually, by calling resume: https://github.com/nodejs/node/blob/master/test/parallel/test-stream-pipe-await-drain-manual-resume.js#L29-L34.
You need to check that awaitDrain gets increased.
On that test, you should basically check that awaitDrain goes to zero as describe in: https://github.com/nodejs/node/blob/master/test/parallel/test-stream-pipe-await-drain-manual-resume.js#L37-L40
shmuga commentedon Oct 3, 2016
@mcollina great. will add some more tests for manual-resume. But I think this comment
is a bit strange at the place "increase again".
As we have only one writer here - the counter can't be increased more than one time.
So probably I will change that comment.
mcollina commentedon Oct 3, 2016
@shmuga resume interacts with
awaitDrain: https://github.com/nodejs/node/blob/master/lib/_stream_readable.js#L741See also https://github.com/nodejs/node/blob/master/lib/_stream_readable.js#L556.
When was that test added? Who did it? It might be worth getting the original PR here, and discussing with the author.
shmuga commentedon Oct 4, 2016
@mcollina I found nice description of this test in commit e2e615e
I will just follow those instructions and add cover tests for
awaitDrainstate variable.mcollina commentedon Jan 18, 2017
Closed by 21a077a
test: tests for _readableStream.awaitDrain
test: tests for _readableStream.awaitDrain
test: tests for _readableStream.awaitDrain
test: tests for _readableStream.awaitDrain
test: tests for _readableStream.awaitDrain
test: tests for _readableStream.awaitDrain
test: tests for _readableStream.awaitDrain
test: tests for _readableStream.awaitDrain
test: tests for _readableStream.awaitDrain