fix(test): stream large report snapshot SQL
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ export type PostgresFixture = {
|
||||
connectionUrl(role: string, password: string): string;
|
||||
psql(sql: string): string;
|
||||
psqlAs(role: string, password: string, sql: string): string;
|
||||
psqlScriptAs(role: string, password: string, sql: string): string;
|
||||
stop(): void;
|
||||
};
|
||||
|
||||
@@ -270,6 +271,37 @@ export function startPostgresFixture(): PostgresFixture {
|
||||
{ encoding: "utf8", env: environment },
|
||||
).trim();
|
||||
},
|
||||
psqlScriptAs(role, password, sql) {
|
||||
return execFileSync(
|
||||
"docker",
|
||||
[
|
||||
...composeArguments,
|
||||
"exec",
|
||||
"-T",
|
||||
"-e",
|
||||
`PGPASSWORD=${password}`,
|
||||
"postgres",
|
||||
"psql",
|
||||
"-X",
|
||||
"-At",
|
||||
"-v",
|
||||
"ON_ERROR_STOP=1",
|
||||
"--single-transaction",
|
||||
"-f",
|
||||
"-",
|
||||
"-U",
|
||||
role,
|
||||
"-d",
|
||||
"jyotisha",
|
||||
],
|
||||
{
|
||||
encoding: "utf8",
|
||||
env: environment,
|
||||
input: sql,
|
||||
maxBuffer: 16 * 1024 * 1024,
|
||||
},
|
||||
).trim();
|
||||
},
|
||||
stop() {
|
||||
try {
|
||||
execFileSync(
|
||||
|
||||
Reference in New Issue
Block a user