From a587be009de0e6d47283cb8ee30b2518438d33e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 29 Oct 2026 11:51:39 +0100 Subject: [PATCH] test(backup): report a broken pipe in the dump test's docker wrapper Under a loaded full run the wrapper around pg_dump and pg_restore crashed with an unhandled stream error, and the dump under test reported only the tail of that stack. The wrapper now leaves the exit code to the tool and writes the reason to stderr. --- tests/integration/database-backup.test.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/integration/database-backup.test.ts b/tests/integration/database-backup.test.ts index 8fabb9b7a..e82f4965f 100644 --- a/tests/integration/database-backup.test.ts +++ b/tests/integration/database-backup.test.ts @@ -93,7 +93,17 @@ env.push("-e", "PGHOST=127.0.0.1", "-e", "PGPORT=5432"); const child = spawn("docker", ["exec", ...(input ? ["-i"] : []), ...env, ${JSON.stringify(container)}, ${JSON.stringify(tool)}, ...args], { stdio: [input ? "pipe" : "ignore", "inherit", "inherit"], }); -if (input) createReadStream(input).pipe(child.stdin); +// A docker client that exits before it has read all of the input closes the +// pipe under us; that is the tool's failure to report, not a crash of this +// wrapper, so the exit code below carries it and the reason goes to stderr. +child.on("error", (err) => { + process.stderr.write("shim: " + err.message + "\\n"); + process.exit(127); +}); +if (input) { + child.stdin.on("error", (err) => process.stderr.write("shim stdin: " + err.code + "\\n")); + createReadStream(input).pipe(child.stdin); +} child.on("exit", (code, signal) => process.exit(code ?? (signal ? 1 : 0))); `, );