Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test(GBRA-156): run the new Postgres arms in the unit-postgres lane; construct PGLiteEngine in beforeAll
garrytan5018d45bcd46
diff --git a/test/oneshot-housekeeping-cli.test.ts b/test/oneshot-housekeeping-cli.test.tsindex 1837c887d5..75948ccea3 100644--- a/test/oneshot-housekeeping-cli.test.ts+++ b/test/oneshot-housekeeping-cli.test.ts@@ -19,7 +19,7 @@ for (const backend of testBackends()) {let home: string;let close: (() => Promise<void>) | undefined;let pg: BrainEngine | undefined;- const pglite = new PGLiteEngine();+ let pglite: PGLiteEngine;async function cli(args: string[], stdin?: string, env: Record<string, string> = {}) {const child = Bun.spawn([process.execPath, '--no-env-file', CLI, ...args], {@@ -32,8 +32,8 @@ for (const backend of testBackends()) {async function sql<T>(text: string, params: unknown[] = []): Promise<T[]> {if (pg) return pg.executeRaw<T>(text, params);const { database_path } = JSON.parse(readFileSync(join(home, '.gbrain', 'config.json'), 'utf8'));- await pglite.connect({ database_path });- try { return await pglite.executeRaw<T>(text, params); } finally { await pglite.disconnect(); }+ await pglite!.connect({ database_path });+ try { return await pglite!.executeRaw<T>(text, params); } finally { await pglite!.disconnect(); }}const lastCompaction = async () => (await sql<{ value: string }>("SELECT value FROM config WHERE key='persistence.maintenance.last_compaction'"))[0]?.value;const compacted = async () => (await sql<{ n: number }>('SELECT count(*)::int AS n FROM persistence_requests WHERE compacted'))[0]!.n;@@ -49,6 +49,7 @@ for (const backend of testBackends()) {const init = await cli(['init', '--url', url.toString(), '--non-interactive', '--no-embedding']);expect(init.code, init.stderr).toBe(0);} else {+ pglite = new PGLiteEngine();const init = await cli(['init', '--pglite', '--no-embedding']);expect(init.code, init.stderr).toBe(0);}diff --git a/test/postgres-unit-arms.txt b/test/postgres-unit-arms.txtindex eefa5ac111..f69ccd440c 100644--- a/test/postgres-unit-arms.txt+++ b/test/postgres-unit-arms.txt@@ -234,6 +234,7 @@ test/managed-sync-stale-group-head.test.tstest/migration-persistence-request-id-index.test.tstest/migration-persistence-request-slug-index.test.tstest/on-commit-embedding.serial.test.ts+test/oneshot-housekeeping-cli.test.tstest/origin-guard-6948.test.tstest/origin-twin-sequence-7150.test.tstest/origin-twins-6948.test.ts@@ -468,6 +469,7 @@ test/visibility-repair-scale.test.tstest/withdrawal-overlay-concurrency.test.tstest/withdrawal-publication-file.test.tstest/worktree-refresh-recovery-row-gbra130.test.ts+test/write-roundtrips-gbra156.test.tstest/write-through-leak-guard-alias-7203.test.tstest/writer-status-movement-not-read-gbra130.test.tstest/writer-status-owner-backends.test.ts