mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
test(relay): wait for the relay's own close before confirming a resume (#34117)
The served-relay blackbox test closed the phone and data sockets from the client and sent the resume confirm before the relay had processed the close, so on a busy runner the relay correctly answered device-resume-confirmed and the test failed (about 1.8% under load). The test now closes only the phone and waits for the relay to close the data leg with 4408, which happens in the same step that marks the connection inactive. Test-only.
This commit is contained in:
@@ -974,15 +974,12 @@ describe('served relay URL', () => {
|
||||
credential: resumeToken
|
||||
})
|
||||
const originalExpiry = first.hello.resumeExpiresAt
|
||||
const firstPhoneClosed = new Promise<void>((resolveClose) =>
|
||||
first.phone.once('close', () => resolveClose())
|
||||
)
|
||||
const firstDataClosed = new Promise<void>((resolveClose) =>
|
||||
first.data.once('close', () => resolveClose())
|
||||
// Only the relay's close of the data leg proves it saw the phone leave; a client-side close can race the confirm.
|
||||
const firstDataClosed = new Promise<number>((resolveClose) =>
|
||||
first.data.once('close', (code) => resolveClose(code))
|
||||
)
|
||||
first.phone.close()
|
||||
first.data.close()
|
||||
await Promise.all([firstPhoneClosed, firstDataClosed])
|
||||
expect(await firstDataClosed).toBe(4408)
|
||||
const closedBasis = nextMessage(host.socket)
|
||||
host.socket.send(
|
||||
JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user