Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test(e2e): sync-parallel leak probe waits for closed worker backends to exit before counting (a real leak still fails)
garrytan8afa2fe5f657
diff --git a/test/e2e/sync-parallel.test.ts b/test/e2e/sync-parallel.test.tsindex 5462bd07bb..e4e839ad57 100644--- a/test/e2e/sync-parallel.test.ts+++ b/test/e2e/sync-parallel.test.ts@@ -20,6 +20,7 @@ import { join } from 'path';import { tmpdir } from 'os';import { execSync } from 'child_process';import { hasDatabase, setupDB, teardownDB, getEngine, getConn } from './helpers.ts';+import { waitFor } from '../helpers/wait-for.ts';const skip = !hasDatabase();const describeE2E = skip ? describe.skip : describe;@@ -89,7 +90,10 @@ describeE2E('E2E sync-parallel: T2 happy path + leak probe', () => {// also accepts --workers); status is 'first_sync'.expect(result.status).toBe('first_sync');- const after = await activeConnections();+ // A closed client's server backend exits asynchronously, so a worker+ // connection can still be listed for a moment after its engine closed.+ let after = await activeConnections();+ await waitFor(async () => (after = await activeConnections()) - before < 4, { timeoutMs: 5000, label: 'worker backends exited' }).catch(() => undefined);// Allow some slack — the helper engine + sync's normal pool stay open.// Worker engines (4 × 2 = 8 connections) MUST have closed; if they