mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 10:19:43 +00:00
Share one configured PostgreSQL pool across worker repositories and make API and worker connection budgets explicit. Add privacy-safe aggregate request, query, pool, sync, and outbox telemetry, a loopback-only representative load fixture, bounded worker shutdown, and focused regression and integration coverage. Document the database-wide budget formula and defer pg_stat_statements activation to a reviewed migration and planned restart.
18 lines
1.0 KiB
TypeScript
18 lines
1.0 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { requireLocalApi, requireLoopback } from '../src/load/loopback.js';
|
|
|
|
describe('representative load fixture boundary', () => {
|
|
it('accepts only loopback API and PostgreSQL URLs', () => {
|
|
expect(requireLoopback('http://127.0.0.1:3003', 'API').hostname).toBe('127.0.0.1');
|
|
expect(requireLoopback('postgresql://sauci:test@localhost:5432/sauci', 'DATABASE').hostname).toBe('localhost');
|
|
expect(() => requireLoopback('https://api.sauci.example', 'API')).toThrow('must resolve to loopback');
|
|
expect(() => requireLoopback('postgresql://sauci:test@db.internal:5432/sauci', 'DATABASE')).toThrow('must resolve to loopback');
|
|
});
|
|
|
|
it('allows only the controlled local HTTP API port', () => {
|
|
expect(requireLocalApi('http://127.0.0.1:3003').port).toBe('3003');
|
|
expect(() => requireLocalApi('https://127.0.0.1:3003')).toThrow('must be http loopback');
|
|
expect(() => requireLocalApi('http://127.0.0.1:3004')).toThrow('must be http loopback');
|
|
});
|
|
});
|