test: fix flaky parallel/test-http2-client-upload
In parallel/test-http2-client-upload, the `client.destroy()` call could terminate the connection before all data was sent over the wire successfully. Using `client.shutdown()` removes the flakiness. Also, listen on `req.on('finish')` rather than the file stream’s `end` event, since we’re not interested in when the source stream finishes, but rather when the HTTP/2 stream finishes. PR-URL: https://github.com/nodejs/node/pull/17361 Refs: https://github.com/nodejs/node/pull/17356 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Kyle Farnung <kfarnung@microsoft.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
This commit is contained in:
parent
1c1ef3c3b0
commit
6fc8765e4e
@ -38,7 +38,7 @@ fs.readFile(loc, common.mustCall((err, data) => {
|
|||||||
function maybeClose() {
|
function maybeClose() {
|
||||||
if (--remaining === 0) {
|
if (--remaining === 0) {
|
||||||
server.close();
|
server.close();
|
||||||
client.destroy();
|
client.shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ fs.readFile(loc, common.mustCall((err, data) => {
|
|||||||
req.resume();
|
req.resume();
|
||||||
req.on('end', common.mustCall(maybeClose));
|
req.on('end', common.mustCall(maybeClose));
|
||||||
const str = fs.createReadStream(loc);
|
const str = fs.createReadStream(loc);
|
||||||
str.on('end', common.mustCall(maybeClose));
|
req.on('finish', common.mustCall(maybeClose));
|
||||||
str.pipe(req);
|
str.pipe(req);
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user