From ddb7df76deb6d4f7b48054bc7b75529900f29d3b 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. PR-URL: https://github.com/nodejs/node/pull/45212 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Juan José Arboleda --- 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');