mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
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.
This commit is contained in:
1 parent
20585f3b3d
commit
a587be009d
1 file changed
+11
-1
@@ -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)));
|
||||
`,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user