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.

PR-URL: https://github.com/nodejs/node/pull/45212
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
This commit is contained in:
Santiago Gimeno authored and Danielle Adams committed 2023-01-03 08:38:29 -05:00
1 parent 1f5975ef50
commit a110cac4f3
1 file changed
+3 -1
@@ -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');