Skip to content

test(wpt): retry WPT server startup on port conflicts or timeout#5215

Merged
mcollina merged 2 commits intonodejs:mainfrom
trivikr:test-wpt-runner-retry
May 6, 2026
Merged

test(wpt): retry WPT server startup on port conflicts or timeout#5215
mcollina merged 2 commits intonodejs:mainfrom
trivikr:test-wpt-runner-retry

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented May 5, 2026

This relates to...

Fixes: #5184

Rationale

The WPT server binds to several randomly-assigned ephemeral ports (for https-local, http-local, etc.). On busy CI runners, these can collide with ports already in use, causing the server to exit with code 1 before all readiness checks pass. This is non-deterministic and depends on what else is running on the host.

Changes

  • Extract server startup logic into a startWPTServer() function
  • Wrap it in a retry loop (up to 3 attempts, 2-second delay between retries) so a fresh attempt picks different random ports
  • Deduplicate the server URL string into a WPT_SERVER_URL constant
  • Use setTimeout from node:timers/promises for the retry delay

Features

N/A

Bug Fixes

Fixes intermittent WPT test failures on CI where the Python WPT server exits before becoming ready due to ephemeral port collisions ([Errno 98] Address already in use) or readiness timeouts.

Breaking Changes and Deprecations

N/A

Status

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.27%. Comparing base (4f8f814) to head (709c819).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5215   +/-   ##
=======================================
  Coverage   93.27%   93.27%           
=======================================
  Files         110      110           
  Lines       36366    36366           
=======================================
  Hits        33922    33922           
  Misses       2444     2444           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 02f0981 into nodejs:main May 6, 2026
35 checks passed
@trivikr trivikr deleted the test-wpt-runner-retry branch May 6, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[flaky] test/web-platform-tests/wpt-runner.mjs

3 participants