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:
parent
02d3709944
commit
151b7786ed
10 changed files with 152 additions and 59 deletions
|
|
@ -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 {} },
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue