From 14b785ecd353e751fcf06e5324febd1af18296f3 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Thu, 15 Oct 2026 23:21:09 +0000 Subject: [PATCH] test: run the fetch test for a pooled socket that is mid-renegotiation The request that takes the pooled socket gets its answer now that uSockets retries the parked write when a renegotiation ends, so the test is no longer a todo. The Node peer exits when its stdin closes. The test runner does not kill the processes of a concurrent test that times out, so a failed run left the peer and the client running. --- .../fetch/fetch.tls.renegotiation-peer-fixture.mjs | 3 +++ test/js/web/fetch/fetch.tls.test.ts | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/test/js/web/fetch/fetch.tls.renegotiation-peer-fixture.mjs b/test/js/web/fetch/fetch.tls.renegotiation-peer-fixture.mjs index 5ccb2da7de6a..c78d106590bd 100644 --- a/test/js/web/fetch/fetch.tls.renegotiation-peer-fixture.mjs +++ b/test/js/web/fetch/fetch.tls.renegotiation-peer-fixture.mjs @@ -84,3 +84,6 @@ const control = http.createServer((req, res) => { }); const controlPort = await listen(control); console.log(relayPort, controlPort); + +// The test process is gone: do not outlive it. +process.stdin.on("end", () => process.exit(0)).resume(); diff --git a/test/js/web/fetch/fetch.tls.test.ts b/test/js/web/fetch/fetch.tls.test.ts index 25914e5ee3b7..54769868bd97 100644 --- a/test/js/web/fetch/fetch.tls.test.ts +++ b/test/js/web/fetch/fetch.tls.test.ts @@ -563,6 +563,10 @@ describe.concurrent("fetch-tls", () => { await using peer = Bun.spawn({ cmd: [nodeExe()!, join(import.meta.dir, "fetch.tls.renegotiation-peer-fixture.mjs")], env: { ...bunEnv, SERVER_CERT: validTls.cert, SERVER_KEY: validTls.key }, + // The runner does not kill the processes of a concurrent test that + // times out. The peer exits when this pipe closes, and the client + // ends with the peer. + stdin: "pipe", stdout: "pipe", stderr: "inherit", }); @@ -610,13 +614,13 @@ describe.concurrent("fetch-tls", () => { timeout, ); - // Observed: the request gets no answer, and the test times out. Its write - // parks while the renegotiation runs, and uSockets does not retry it when - // the renegotiation ends. - it.todo( + // The request's write parks while the renegotiation runs. uSockets has to + // retry it when the renegotiation ends, or the request gets no answer. + it.skipIf(!nodeExe())( "a request that reuses a pooled socket mid-renegotiation gets its answer", async () => { - const { stdout, exitCode } = await pickUpMidRenegotiation("await-second"); + const { stdout, stderr, exitCode } = await pickUpMidRenegotiation("await-second"); + expect(stderr).toBe(""); expect(stdout).toEqual(["first ok", "held record type 22", "after the pooled pickup pong", "second ok"]); expect(exitCode).toBe(0); },