mirror of
https://github.com/garrytan/gbrain.git
synced 2026-07-27 22:15:33 +00:00
fix(test): canonical beforeAll/afterAll PGLite pattern in query-embed-deadline test
check-test-isolation R3+R4: engine creation moves into beforeAll, add afterAll(disconnect) so the engine doesn't leak across files in the shard process. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
d23b5a6ed4
commit
5e586efad7
@@ -12,7 +12,7 @@
|
||||
* insufficient against a wedged provider), and that a shared/elapsed deadline
|
||||
* makes a second embed fail FAST (worst case ~one timeout, not two).
|
||||
*/
|
||||
import { describe, test, expect, beforeEach, afterEach } from 'bun:test';
|
||||
import { describe, test, expect, beforeAll, afterAll, beforeEach, afterEach } from 'bun:test';
|
||||
import {
|
||||
configureGateway,
|
||||
resetGateway,
|
||||
@@ -93,21 +93,24 @@ describe('embedQueryBounded — query-embed deadline', () => {
|
||||
describe('hybridSearch meta.degraded_reason (#2028)', () => {
|
||||
let engine: import('../../src/core/pglite-engine.ts').PGLiteEngine;
|
||||
|
||||
beforeEach(async () => {
|
||||
beforeAll(async () => {
|
||||
const { PGLiteEngine } = await import('../../src/core/pglite-engine.ts');
|
||||
engine = new PGLiteEngine();
|
||||
await engine.connect({});
|
||||
await engine.initSchema();
|
||||
await engine.putPage('notes/hello', {
|
||||
type: 'note' as any,
|
||||
title: 'hello',
|
||||
compiled_truth: 'hello world content',
|
||||
timeline: '',
|
||||
frontmatter: {},
|
||||
});
|
||||
});
|
||||
afterAll(async () => {
|
||||
await engine.disconnect();
|
||||
});
|
||||
beforeEach(() => {
|
||||
resetGateway();
|
||||
if (!engine) {
|
||||
const { PGLiteEngine } = await import('../../src/core/pglite-engine.ts');
|
||||
engine = new PGLiteEngine();
|
||||
await engine.connect({});
|
||||
await engine.initSchema();
|
||||
await engine.putPage('notes/hello', {
|
||||
type: 'note' as any,
|
||||
title: 'hello',
|
||||
compiled_truth: 'hello world content',
|
||||
timeline: '',
|
||||
frontmatter: {},
|
||||
});
|
||||
}
|
||||
});
|
||||
afterEach(async () => {
|
||||
__setEmbedTransportForTests(null);
|
||||
|
||||
Reference in New Issue
Block a user