27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
import { readFileSync } from 'node:fs';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { parse } from 'yaml';
|
|
|
|
describe('container deployment boundaries', () => {
|
|
const compose = parse(readFileSync('compose.yaml', 'utf8')) as {
|
|
services: Record<string, { environment?: Record<string, string>; depends_on?: unknown }>;
|
|
};
|
|
|
|
it('probes the versioned liveness route', () => {
|
|
expect(readFileSync('Dockerfile', 'utf8')).toContain('/api/v1/staff/live');
|
|
expect(readFileSync('Dockerfile', 'utf8')).not.toMatch(/8080\/live\b/);
|
|
});
|
|
|
|
it('does not expose migration credentials to the runtime service', () => {
|
|
const environment = compose.services.app?.environment ?? {};
|
|
expect(environment).not.toHaveProperty('DATABASE_MIGRATION_URL');
|
|
expect(environment).not.toHaveProperty('POSTGRES_MIGRATION_PASSWORD');
|
|
expect(environment).not.toHaveProperty('POSTGRES_APP_PASSWORD');
|
|
});
|
|
|
|
it('provisions the app role and migrates before app startup', () => {
|
|
expect(compose.services['db-role']).toBeDefined();
|
|
expect(compose.services.migrate?.depends_on).toHaveProperty('db-role');
|
|
expect(compose.services.app?.depends_on).toHaveProperty('migrate');
|
|
});
|
|
});
|