From a8215ce9cd4ef995a58ac2e46643e7c240a3132c Mon Sep 17 00:00:00 2001 From: Khafra Date: Mon, 26 Dec 2022 01:19:36 -0500 Subject: [PATCH] fix(WPTs): flaky abort test (#1835) --- test/wpt/runner/runner/runner.mjs | 7 +++++++ test/wpt/server/server.mjs | 7 ++++--- test/wpt/status/fetch.status.json | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/test/wpt/runner/runner/runner.mjs b/test/wpt/runner/runner/runner.mjs index 8dfb21e8236..da5cb96899c 100644 --- a/test/wpt/runner/runner/runner.mjs +++ b/test/wpt/runner/runner/runner.mjs @@ -112,6 +112,12 @@ export class WPTRunner extends EventEmitter { }) activeWorkers.add(worker) + const timeout = setTimeout( + () => { + console.warn('Test timed out:', test) + }, + meta.timeout === 'long' ? 60_000 : 10_000 + ) worker.on('message', (message) => { if (message.type === 'result') { @@ -123,6 +129,7 @@ export class WPTRunner extends EventEmitter { worker.once('exit', () => { activeWorkers.delete(worker) + clearTimeout(timeout) if (activeWorkers.size === 0) { this.handleRunnerCompletion() diff --git a/test/wpt/server/server.mjs b/test/wpt/server/server.mjs index bcb77e548d9..13b8856a1f4 100644 --- a/test/wpt/server/server.mjs +++ b/test/wpt/server/server.mjs @@ -115,18 +115,19 @@ const server = createServer(async (req, res) => { while (true) { if (!res.write('.')) { break - } else if (abortKey && stash.take(abortKey, fullUrl.pathname)) { + } else if (abortKey && stash.take(abortKey)) { break } - await sleep(10) + await sleep(100) } if (stateKey) { stash.put(stateKey, 'closed', fullUrl.pathname) } - return res.end() + res.end() + return } case '/fetch/api/resources/stash-take.py': { // https://github.com/web-platform-tests/wpt/blob/6ae3f702a332e8399fab778c831db6b7dca3f1c6/fetch/api/resources/stash-take.py diff --git a/test/wpt/status/fetch.status.json b/test/wpt/status/fetch.status.json index 3a16a27eeb9..1a6a5084746 100644 --- a/test/wpt/status/fetch.status.json +++ b/test/wpt/status/fetch.status.json @@ -1,6 +1,6 @@ { "general.any.js": { - "fail": [ + "flaky": [ "Already aborted signal rejects immediately", "Underlying connection is closed when aborting after receiving response - no-cors", "Stream errors once aborted. Underlying connection closed."