Skip to content

Commit

Permalink
test: deflake http2-pipe-named-pipe
Browse files Browse the repository at this point in the history
Wait for all data to be read before sending the response and closing
the client.

Fixes: #40277

PR-URL: #40842
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Adrian Estrada <[email protected]>
  • Loading branch information
lpinca authored and targos committed Nov 21, 2021
1 parent c485460 commit b190b0e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/parallel/test-http2-pipe-named-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ const server = http2.createServer();
server.on('stream', common.mustCall((stream) => {
const dest = stream.pipe(fs.createWriteStream(fn));

dest.on('finish', () => {
stream.on('end', common.mustCall(() => {
stream.respond();
stream.end();
}));

dest.on('finish', common.mustCall(() => {
assert.strictEqual(fs.readFileSync(loc).length,
fs.readFileSync(fn).length);
});
stream.respond();
stream.end();
}));
}));

server.listen(common.PIPE, common.mustCall(() => {
Expand Down

0 comments on commit b190b0e

Please sign in to comment.