-
Notifications
You must be signed in to change notification settings - Fork 725
Additional streams test consolidation gaps #7182
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
Open
jasnell
wants to merge
3
commits into
jasnell/streams-test-consolidation-10
from
jasnell/streams-test-consolidation-11
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -237,3 +237,115 @@ export const errorTypePreservationPipeThrough = { | |||||||||||||||||||||||||||||||||||||||||||||||||
| strictEqual(reason.code, 'ERR_PIPE'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // The WPT 'starts errored … abort promise' residue: the destination's | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // abort() hook returns a PROMISE. Fulfilled: consumed silently, the | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // pipe still rejects with the SOURCE error. Rejected: per spec the | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // shutdown action's failure REPLACES the rejection reason. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| export const destAbortPromiseStates = { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| async test() { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Fulfilled abort promise. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const err = new Error('src-err'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| let abortCalled = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const rs = new ReadableStream({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| start(c) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| c.error(err); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const ws = new WritableStream({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| abort() { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| abortCalled = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return Promise.resolve('ignored'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| strictEqual(await rejectionOf(rs.pipeTo(ws)), err); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| strictEqual(abortCalled, true); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Rejected abort promise. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const err = new Error('src-err'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const abortErr = new Error('abort-failed'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const rs = new ReadableStream({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| start(c) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| c.error(err); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const ws = new WritableStream({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| abort() { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return Promise.reject(abortErr); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const reason = await rejectionOf(rs.pipeTo(ws)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| strictEqual(reason, abortErr); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // preventAbort AND preventCancel together on a starts-errored source: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // both suppressions hold and both ends stay un-shut-down. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| export const preventAbortAndCancelCombo = { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| async test() { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const err = new Error('src-err'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| let abortCalled = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const rs = new ReadableStream({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| start(c) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| c.error(err); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const ws = new WritableStream({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| abort() { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| abortCalled = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| strictEqual( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| await rejectionOf( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| rs.pipeTo(ws, { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| preventAbort: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| preventCancel: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| preventClose: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| err | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| strictEqual(abortCalled, false); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ws.getWriter(); // dest untouched and re-lockable | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // The WPT 'shutdown must not occur until the final write completes' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // shape: the source errors while a write is IN FLIGHT — the | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // destination's abort must not run until that write settles. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| export const shutdownWaitsForInFlightWrite = { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| async test() { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const err = new Error('src-err'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const events = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| let releaseWrite; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const parked = new Promise((resolve) => (releaseWrite = resolve)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| let controller; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const rs = new ReadableStream({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| start(c) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| controller = c; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const ws = new WritableStream({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| write() { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| events.push('write-start'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return parked; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| abort(reason) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| events.push(`abort:${reason.message}`); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const pipeP = rs.pipeTo(ws); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| controller.enqueue('chunk'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| await scheduler.wait(10); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| controller.error(err); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| await scheduler.wait(20); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // The write is still parked: abort must not have run yet. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| strictEqual(events.join(','), 'write-start'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| releaseWrite(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| strictEqual(await rejectionOf(pipeP), err); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+340
to
+348
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This only observes that
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| strictEqual(events.join(','), 'write-start,abort:src-err'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
A source error only takes the destination-abort branch; it never attempts to cancel the source. This test therefore cannot observe
preventCancel, so a regression in that option passes while the comment claims both suppressions are covered. An abort signal initiates both shutdown actions.