Skip to content

Commit

Permalink
fix(WPTs): flaky abort test (nodejs#1835)
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev authored and crysmags committed Feb 27, 2024
1 parent 40f36f4 commit a8215ce
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 7 additions & 0 deletions test/wpt/runner/runner/runner.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand All @@ -123,6 +129,7 @@ export class WPTRunner extends EventEmitter {

worker.once('exit', () => {
activeWorkers.delete(worker)
clearTimeout(timeout)

if (activeWorkers.size === 0) {
this.handleRunnerCompletion()
Expand Down
7 changes: 4 additions & 3 deletions test/wpt/server/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/wpt/status/fetch.status.json
Original file line number Diff line number Diff line change
@@ -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."
Expand Down

0 comments on commit a8215ce

Please sign in to comment.