Skip to content

Commit 68a7bb1

Browse files
committed
test(egress): cover the 5xx CONNECT retry path
1 parent 047abed commit 68a7bb1

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

‎apps/sim/lib/core/network/gateway.server.test.ts‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -373,15 +373,22 @@ describe('organization gateways over real TLS CONNECT sockets', () => {
373373
}
374374
})
375375

376-
it('retries a CONNECT dropped before the tunnel opens and completes the request', async () => {
377-
connectFailures.push('reset')
378-
const start = admissions.length
379-
const response = await runWithOutboundOrganization('org_a', () =>
380-
secureFetchWithPinnedIP(url(), '1.1.1.1', options)
381-
)
382-
expect(await response.text()).toBe('tls reached')
383-
expect(admissions.length).toBe(start + 2)
384-
})
376+
it.each(['reset', 503] as const)(
377+
'retries a CONNECT that fails with %s before the tunnel opens and completes the request',
378+
async (failure) => {
379+
connectFailures.push(failure)
380+
const start = admissions.length
381+
try {
382+
const response = await runWithOutboundOrganization('org_a', () =>
383+
secureFetchWithPinnedIP(url(), '1.1.1.1', options)
384+
)
385+
expect(await response.text()).toBe('tls reached')
386+
expect(admissions.length).toBe(start + 2)
387+
} finally {
388+
connectFailures.length = 0
389+
}
390+
}
391+
)
385392

386393
it('does not retry a rejected proxy credential', async () => {
387394
const start = admissions.length

0 commit comments

Comments
 (0)