Skip to content

Commit b190b0e

Browse files
lpincatargos
authored andcommitted
test: deflake http2-pipe-named-pipe
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]>
1 parent c485460 commit b190b0e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test/parallel/test-http2-pipe-named-pipe.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ const server = http2.createServer();
2222
server.on('stream', common.mustCall((stream) => {
2323
const dest = stream.pipe(fs.createWriteStream(fn));
2424

25-
dest.on('finish', () => {
25+
stream.on('end', common.mustCall(() => {
26+
stream.respond();
27+
stream.end();
28+
}));
29+
30+
dest.on('finish', common.mustCall(() => {
2631
assert.strictEqual(fs.readFileSync(loc).length,
2732
fs.readFileSync(fn).length);
28-
});
29-
stream.respond();
30-
stream.end();
33+
}));
3134
}));
3235

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

0 commit comments

Comments
 (0)