From eee587b847746fc1a243146b3e84edb1d5adb07f Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 1 Apr 2020 22:22:41 -0400 Subject: [PATCH] test: fix test-http2-reset-flood flakiness Refs: https://github.com/nodejs/node/issues/29802#issuecomment-607522598 PR-URL: https://github.com/nodejs/node/pull/32607 Reviewed-By: Anna Henningsen --- test/parallel/test-http2-reset-flood.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http2-reset-flood.js b/test/parallel/test-http2-reset-flood.js index 7ee534cf4faa4e..d721384ab3742e 100644 --- a/test/parallel/test-http2-reset-flood.js +++ b/test/parallel/test-http2-reset-flood.js @@ -69,9 +69,10 @@ const worker = new Worker(__filename).on('message', common.mustCall((port) => { h2header.writeIntBE(streamId, 5, 4); // Stream ID streamId += 2; // 0x88 = :status: 200 - conn.write(Buffer.concat([h2header, Buffer.from([0x88])])); + if (conn.writable) + conn.write(Buffer.concat([h2header, Buffer.from([0x88])])); } - if (!gotError) + if (conn.writable && !gotError) setImmediate(writeRequests); }