perf: 프로필 DB 풀과 advisory lock 격리
역할별 PostgreSQL pool 상한과 동일 process 공유 pool을 적용하고 health 지표를 노출한다.\n\n게임 기능 advisory lock을 schema namespace로 통일하고 실제 PostgreSQL 통합 하네스를 보강한다.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { DEFAULT_POSTGRES_POOL_MAX, resolvePostgresConfigFromEnv, resolvePostgresPoolMax } from '../src/postgres.js';
|
||||
|
||||
describe('PostgreSQL pool configuration', () => {
|
||||
it('uses the driver-compatible default when no explicit budget exists', () => {
|
||||
expect(resolvePostgresPoolMax(undefined)).toBe(DEFAULT_POSTGRES_POOL_MAX);
|
||||
expect(
|
||||
resolvePostgresConfigFromEnv({
|
||||
env: { DATABASE_URL: 'postgresql://integration.invalid/sammo?schema=che' },
|
||||
})
|
||||
).toMatchObject({ maxConnections: DEFAULT_POSTGRES_POOL_MAX });
|
||||
});
|
||||
|
||||
it('accepts an explicit environment budget', () => {
|
||||
expect(
|
||||
resolvePostgresConfigFromEnv({
|
||||
env: {
|
||||
DATABASE_URL: 'postgresql://integration.invalid/sammo?schema=che',
|
||||
POSTGRES_POOL_MAX: '4',
|
||||
},
|
||||
})
|
||||
).toMatchObject({ maxConnections: 4 });
|
||||
});
|
||||
|
||||
it.each(['0', '-1', '1.5', '1001', 'not-a-number'])('rejects invalid pool budget %s', (value) => {
|
||||
expect(() => resolvePostgresPoolMax(value)).toThrow(/pool max/u);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user