Tests wait for state instead of sleeping, on free ports

The relay, parity and benchmark server tests slept fixed times before
asserting, which a busy CI runner overran. They now wait for what they
need (the relay reports what it holds), take a port from the OS, and
use fresh HTTP connections. npm test -- --stress N hunts flakes.
This commit is contained in:
Frederic Jung 2026-11-05 11:38:26 +01:00
parent 02d3709944
commit 151b7786ed
No known key found for this signature in database
10 changed files with 152 additions and 59 deletions

View file

@ -106,6 +106,8 @@ function createRelay({ server } = {}) {
return {
wss, path: AGENT_PATH,
// What the relay holds right now, so tests wait for a state instead of sleeping.
status: () => ({ page: !!(page && page.readyState === 1), tools: [...tools].filter((t) => t.readyState === 1).length, calls: pending.size }),
close() { for (const c of [page, ...tools]) { try { c.close(4002, 'relay shutdown'); } catch {} } try { wss.close(); } catch {} },
};
}