This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

test: verify send-style DATA socket resolves 'finish' promptly

Ensures a fire-and-forget DATA socket (connect → write → end) gets
the 'finish' event quickly, rather than hanging waiting for the server
to send FIN back ('close' event). This pattern is unreliable in Linux
namespace containers.

Refs #18

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Johannes Schickling (Apr 16, 2026, 1:43 PM +0200) 139fccb2 f134bf63

+28
+28
tests/integration.test.ts
··· 1098 1098 client2.destroy(); 1099 1099 }); 1100 1100 } 1101 + 1102 + it("send-style DATA socket resolves 'finish' promptly without waiting for server FIN", async () => { 1103 + const name = uniqueName(); 1104 + await startServer(name, "cat"); 1105 + 1106 + // Simulate the send() pattern: connect, write DATA packets, end, wait for 'finish'. 1107 + // This must resolve quickly — if it hangs, the socket is waiting for the server 1108 + // to send FIN ('close' event) which is unreliable in some container environments. 1109 + const socketPath = getSocketPath(name); 1110 + const start = Date.now(); 1111 + const result = await Promise.race([ 1112 + new Promise<"ok">((resolve, reject) => { 1113 + const socket = net.createConnection(socketPath); 1114 + socket.on("connect", () => { 1115 + socket.write(encodeData("hello from send\n")); 1116 + socket.end(); 1117 + }); 1118 + socket.on("finish", () => resolve("ok")); 1119 + socket.on("error", reject); 1120 + }), 1121 + new Promise<"timeout">((resolve) => setTimeout(() => resolve("timeout"), 3000)), 1122 + ]); 1123 + const elapsed = Date.now() - start; 1124 + 1125 + expect(result).toBe("ok"); 1126 + // 'finish' should fire almost immediately after socket.end(), not after 3s timeout 1127 + expect(elapsed).toBeLessThan(2000); 1128 + }); 1101 1129 });