diff options
author | Brian White <mscdex@mscdex.net> | 2018-05-01 00:29:16 -0400 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-05-07 09:44:26 +0200 |
commit | 8f6ab9f799925da836b6c106ed9a8b3d95a2935f (patch) | |
tree | 616992afab96f547420ff2bb2eb325861ed84d8a /test/parallel | |
parent | 5efbe4c1e8f9baf4251c40c52ca9452d8f7416ce (diff) | |
download | android-node-v8-8f6ab9f799925da836b6c106ed9a8b3d95a2935f.tar.gz android-node-v8-8f6ab9f799925da836b6c106ed9a8b3d95a2935f.tar.bz2 android-node-v8-8f6ab9f799925da836b6c106ed9a8b3d95a2935f.zip |
Revert "stream: prevent 'end' to be emitted after 'error'"
This reverts commit 08577906569a4c2de70ad2a861e2f8456cd8fcdd.
PR-URL: https://github.com/nodejs/node/pull/20449
Fixes: https://github.com/nodejs/node/issues/20334
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'test/parallel')
14 files changed, 13 insertions, 43 deletions
diff --git a/test/parallel/test-http2-client-destroy.js b/test/parallel/test-http2-client-destroy.js index e641335e75..6238363511 100644 --- a/test/parallel/test-http2-client-destroy.js +++ b/test/parallel/test-http2-client-destroy.js @@ -95,6 +95,7 @@ const Countdown = require('../common/countdown'); }); req.resume(); + req.on('end', common.mustCall()); req.on('close', common.mustCall(() => server.close())); })); } diff --git a/test/parallel/test-http2-client-onconnect-errors.js b/test/parallel/test-http2-client-onconnect-errors.js index f427bfb490..a75dc590c6 100644 --- a/test/parallel/test-http2-client-onconnect-errors.js +++ b/test/parallel/test-http2-client-onconnect-errors.js @@ -101,6 +101,7 @@ function runTest(test) { }); } + req.on('end', common.mustCall()); req.on('close', common.mustCall(() => { client.destroy(); diff --git a/test/parallel/test-http2-client-stream-destroy-before-connect.js b/test/parallel/test-http2-client-stream-destroy-before-connect.js index 9e81015ec5..d834de5d11 100644 --- a/test/parallel/test-http2-client-stream-destroy-before-connect.js +++ b/test/parallel/test-http2-client-stream-destroy-before-connect.js @@ -45,4 +45,5 @@ server.listen(0, common.mustCall(() => { req.on('response', common.mustNotCall()); req.resume(); + req.on('end', common.mustCall()); })); diff --git a/test/parallel/test-http2-compat-serverresponse-destroy.js b/test/parallel/test-http2-compat-serverresponse-destroy.js index 4982208297..8ee52a74ab 100644 --- a/test/parallel/test-http2-compat-serverresponse-destroy.js +++ b/test/parallel/test-http2-compat-serverresponse-destroy.js @@ -63,6 +63,7 @@ server.listen(0, common.mustCall(() => { req.on('close', common.mustCall(() => countdown.dec())); req.resume(); + req.on('end', common.mustCall()); } { @@ -77,5 +78,6 @@ server.listen(0, common.mustCall(() => { req.on('close', common.mustCall(() => countdown.dec())); req.resume(); + req.on('end', common.mustCall()); } })); diff --git a/test/parallel/test-http2-max-concurrent-streams.js b/test/parallel/test-http2-max-concurrent-streams.js index 2b576700aa..b270d6cc6a 100644 --- a/test/parallel/test-http2-max-concurrent-streams.js +++ b/test/parallel/test-http2-max-concurrent-streams.js @@ -45,6 +45,7 @@ server.listen(0, common.mustCall(() => { req.on('aborted', common.mustCall()); req.on('response', common.mustNotCall()); req.resume(); + req.on('end', common.mustCall()); req.on('close', common.mustCall(() => countdown.dec())); req.on('error', common.expectsError({ code: 'ERR_HTTP2_STREAM_ERROR', diff --git a/test/parallel/test-http2-misused-pseudoheaders.js b/test/parallel/test-http2-misused-pseudoheaders.js index 0b7becef5f..c1ae37b9a3 100644 --- a/test/parallel/test-http2-misused-pseudoheaders.js +++ b/test/parallel/test-http2-misused-pseudoheaders.js @@ -41,6 +41,7 @@ server.listen(0, common.mustCall(() => { req.on('response', common.mustCall()); req.resume(); + req.on('end', common.mustCall()); req.on('close', common.mustCall(() => { server.close(); client.close(); diff --git a/test/parallel/test-http2-multi-content-length.js b/test/parallel/test-http2-multi-content-length.js index 908f6ecd64..7d8ff4858f 100644 --- a/test/parallel/test-http2-multi-content-length.js +++ b/test/parallel/test-http2-multi-content-length.js @@ -53,6 +53,7 @@ server.listen(0, common.mustCall(() => { // header to be set for non-payload bearing requests... const req = client.request({ 'content-length': 1 }); req.resume(); + req.on('end', common.mustCall()); req.on('close', common.mustCall(() => countdown.dec())); req.on('error', common.expectsError({ code: 'ERR_HTTP2_STREAM_ERROR', diff --git a/test/parallel/test-http2-respond-file-fd-invalid.js b/test/parallel/test-http2-respond-file-fd-invalid.js index 28d1c0f057..21fcf790b4 100644 --- a/test/parallel/test-http2-respond-file-fd-invalid.js +++ b/test/parallel/test-http2-respond-file-fd-invalid.js @@ -40,7 +40,7 @@ server.listen(0, () => { req.on('response', common.mustCall()); req.on('error', common.mustCall(errorCheck)); req.on('data', common.mustNotCall()); - req.on('close', common.mustCall(() => { + req.on('end', common.mustCall(() => { assert.strictEqual(req.rstCode, NGHTTP2_INTERNAL_ERROR); client.close(); server.close(); diff --git a/test/parallel/test-http2-respond-nghttperrors.js b/test/parallel/test-http2-respond-nghttperrors.js index 4adf678b68..ad9eee0d59 100644 --- a/test/parallel/test-http2-respond-nghttperrors.js +++ b/test/parallel/test-http2-respond-nghttperrors.js @@ -87,7 +87,7 @@ function runTest(test) { req.resume(); req.end(); - req.on('close', common.mustCall(() => { + req.on('end', common.mustCall(() => { client.close(); if (!tests.length) { diff --git a/test/parallel/test-http2-respond-with-fd-errors.js b/test/parallel/test-http2-respond-with-fd-errors.js index 7e7394d293..3a671a3e36 100644 --- a/test/parallel/test-http2-respond-with-fd-errors.js +++ b/test/parallel/test-http2-respond-with-fd-errors.js @@ -95,7 +95,7 @@ function runTest(test) { req.resume(); req.end(); - req.on('close', common.mustCall(() => { + req.on('end', common.mustCall(() => { client.close(); if (!tests.length) { diff --git a/test/parallel/test-http2-server-shutdown-before-respond.js b/test/parallel/test-http2-server-shutdown-before-respond.js index 50b3a5572a..33f224fc69 100644 --- a/test/parallel/test-http2-server-shutdown-before-respond.js +++ b/test/parallel/test-http2-server-shutdown-before-respond.js @@ -32,5 +32,5 @@ server.on('listening', common.mustCall(() => { })); req.resume(); req.on('data', common.mustNotCall()); - req.on('close', common.mustCall(() => server.close())); + req.on('end', common.mustCall(() => server.close())); })); diff --git a/test/parallel/test-http2-server-socket-destroy.js b/test/parallel/test-http2-server-socket-destroy.js index d631ef032b..03afc1957b 100644 --- a/test/parallel/test-http2-server-socket-destroy.js +++ b/test/parallel/test-http2-server-socket-destroy.js @@ -52,4 +52,5 @@ server.on('listening', common.mustCall(() => { req.on('aborted', common.mustCall()); req.resume(); + req.on('end', common.mustCall()); })); diff --git a/test/parallel/test-stream-duplex-error-write.js b/test/parallel/test-stream-duplex-error-write.js deleted file mode 100644 index 5a80ce5c3e..0000000000 --- a/test/parallel/test-stream-duplex-error-write.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -const common = require('../common'); -const { Duplex } = require('stream'); -const { strictEqual } = require('assert'); - -const duplex = new Duplex({ - write(chunk, enc, cb) { - cb(new Error('kaboom')); - }, - read() { - this.push(null); - } -}); - -duplex.on('error', common.mustCall(function() { - strictEqual(this._readableState.errorEmitted, true); - strictEqual(this._writableState.errorEmitted, true); -})); - -duplex.on('end', common.mustNotCall()); - -duplex.end('hello'); -duplex.resume(); diff --git a/test/parallel/test-stream-readable-destroy.js b/test/parallel/test-stream-readable-destroy.js index eecee04294..026aa8ca16 100644 --- a/test/parallel/test-stream-readable-destroy.js +++ b/test/parallel/test-stream-readable-destroy.js @@ -189,18 +189,3 @@ const { inherits } = require('util'); read.push('hi'); read.on('data', common.mustNotCall()); } - -{ - // double error case - const read = new Readable({ - read() {} - }); - - read.on('close', common.mustCall()); - read.on('error', common.mustCall()); - - read.destroy(new Error('kaboom 1')); - read.destroy(new Error('kaboom 2')); - assert.strictEqual(read._readableState.errorEmitted, true); - assert.strictEqual(read.destroyed, true); -} |