Skip to content

Conversation

@italoacasas
Copy link

@italoacasasitaloacasas commented Sep 22, 2016

Checklist
  • make -j4 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
  • test
Description of change
  • Adding tests for stream._writableState.ending
  • Adding comment about needDrain flag

Issue related: #8686

@nodejs-github-botnodejs-github-bot added the stream Issues and PRs related to the stream subsystem. label Sep 22, 2016
@mscdexmscdex added the test Issues and PRs related to the tests. label Sep 22, 2016
@mcollinamcollina self-assigned this Sep 26, 2016
@mcollina
Copy link
Member

mcollina commented Sep 29, 2016

Edit: Not LGTM yet.

Can you please adjust the commit message?

We need to account for this behavior here: mainly we need to check that ending might be true while the other state variables (ended, finished) are false.
https://github.com/nodejs/node/blob/master/lib/_stream_writable.js#L496-L507

@italoacasas
Copy link
Author

italoacasas commented Oct 2, 2016

@mcollina I made some changes in the test, but It was not possible for me to test the fallowing behavior.

  • ending = true while ended = false

The way that functionality is implemented right now is hard to test because they change to true at the "same time" endWritable.

This is my first time reading the stream codebase and maybe I'm not seeing something.

@mcollina
Copy link
Member

@italoacasas you will need to listen to the 'finish' event, which will be emitted in https://github.com/nodejs/node/blob/master/lib/_stream_writable.js#L488 if there are no writes in flight (for which the callback has not be called yet).

@rvaggrvaggforce-pushed the master branch 2 times, most recently from c133999 to 83c7a88CompareOctober 18, 2016 17:02
@italoacasas
Copy link
Author

@mcollina ping

Copy link
Member

@mcollinamcollina left a comment

Choose a reason for hiding this comment

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

LGTM

@mcollina
Copy link
Member

mcollina commented Oct 26, 2016

@mcollina
Copy link
Member

Failures unrelated. This is good to go, I'm planning on merging tomorrow or Friday, if no one else has objections.

@cjihrig
Copy link
Contributor

Could you capitalize and punctuate the comments in this PR. You also have some typos: 'endeding' should be 'ending' in a few places I think. Other than that LGTM.

@mcollina
Copy link
Member

mcollina commented Oct 28, 2016

Merged in fd16eed.

mcollina pushed a commit that referenced this pull request Oct 28, 2016
Add a test for _writableState.ending, when ending becomes true, but the stream is not finished/ended yet. PR-URL: #8707 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Related: #8686
@gibfahn
Copy link
Member

@mcollina Looks like this test is causing a linter error:

/Users/gib/wrk/com/DANGER/node/test/parallel/test-stream-writableState-ending.js3:7error'common'isassignedavaluebutneverusedno-unused-vars

Fix: #9335

evanlucas pushed a commit that referenced this pull request Nov 3, 2016
Add a test for _writableState.ending, when ending becomes true, but the stream is not finished/ended yet. PR-URL: #8707 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Related: #8686
@evanlucasevanlucas mentioned this pull request Nov 3, 2016
MylesBorins pushed a commit that referenced this pull request Nov 17, 2016
Add a test for _writableState.ending, when ending becomes true, but the stream is not finished/ended yet. PR-URL: #8707 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Related: #8686
MylesBorins pushed a commit that referenced this pull request Nov 17, 2016
Add a test for _writableState.ending, when ending becomes true, but the stream is not finished/ended yet. PR-URL: #8707 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Related: #8686
MylesBorins pushed a commit that referenced this pull request Nov 19, 2016
Add a test for _writableState.ending, when ending becomes true, but the stream is not finished/ended yet. PR-URL: #8707 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Related: #8686
This was referenced Nov 22, 2016
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

streamIssues and PRs related to the stream subsystem.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@italoacasas@mcollina@cjihrig@gibfahn@mscdex@MylesBorins@nodejs-github-bot