From f69c8d9d59327d6c62790f7f30c8109c529a1c28 Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Thu, 27 Oct 2022 16:40:57 +0200 Subject: [PATCH] test: deflake test-http2-empty-frame-without-eof It may happen that the data in `emptyframe.http2` reaches the client even before the client has started sending the request, causing an `ERR_HTTP2_STREAM_ERROR` instead. Fix this by making sure the frame is not sent until some data reaches the server. --- test/parallel/test-http2-empty-frame-without-eof.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-http2-empty-frame-without-eof.js b/test/parallel/test-http2-empty-frame-without-eof.js index 2cd7d799769882..c384fdee6faf75 100644 --- a/test/parallel/test-http2-empty-frame-without-eof.js +++ b/test/parallel/test-http2-empty-frame-without-eof.js @@ -10,7 +10,9 @@ const { once } = require('events'); async function main() { const blobWithEmptyFrame = readSync('emptyframe.http2'); const server = net.createServer((socket) => { - socket.end(blobWithEmptyFrame); + socket.once('data', () => { + socket.end(blobWithEmptyFrame); + }); }).listen(0); await once(server, 'listening');