From 978bbf987c688d265a4b23b916d8647dea4d4c41 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 19 Mar 2021 07:44:04 -0700 Subject: [PATCH] test: fix flaky test-http2-pack-end-stream-flag Signed-off-by: James M Snell Fixes: https://github.com/nodejs/node/issues/37639 PR-URL: https://github.com/nodejs/node/pull/37814 Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca --- test/parallel/test-http2-pack-end-stream-flag.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-http2-pack-end-stream-flag.js b/test/parallel/test-http2-pack-end-stream-flag.js index 95b9890733ef62..9c0b3246f35ed7 100644 --- a/test/parallel/test-http2-pack-end-stream-flag.js +++ b/test/parallel/test-http2-pack-end-stream-flag.js @@ -32,12 +32,15 @@ server.on('stream', (stream, headers) => { function testRequest(path, targetFrameCount, callback) { const obs = new PerformanceObserver( common.mustCallAtLeast((list, observer) => { - const entry = list.getEntries()[0]; - if (entry.name !== 'Http2Session') return; - if (entry.detail.type !== 'client') return; - assert.strictEqual(entry.detail.framesReceived, targetFrameCount); - observer.disconnect(); - callback(); + const entries = list.getEntries(); + for (let n = 0; n < entries.length; n++) { + const entry = entries[n]; + if (entry.name !== 'Http2Session') continue; + if (entry.detail.type !== 'client') continue; + assert.strictEqual(entry.detail.framesReceived, targetFrameCount); + observer.disconnect(); + callback(); + } })); obs.observe({ type: 'http2' }); const client =