A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
test(config): replace compose and Helm suites with env check
Hampus36d136a03239
diff --git a/packages/config/src/__tests__/DeployEnvCoverage.test.ts b/packages/config/src/__tests__/DeployEnvCoverage.test.tsdeleted file mode 100644index 23b76de74..000000000--- a/packages/config/src/__tests__/DeployEnvCoverage.test.ts+++ /dev/null@@ -1,82 +0,0 @@-// SPDX-License-Identifier: AGPL-3.0-or-later--import {readdirSync, readFileSync} from 'node:fs';-import path from 'node:path';-import {fileURLToPath} from 'node:url';-import {describe, expect, test} from 'vitest';--const SELF_HOSTING = path.join(fileURLToPath(new URL('../../../../', import.meta.url)), 'deploy/self-hosting');--const INTERPOLATION_PATTERN = /\$\{([A-Z][A-Z0-9_]*)[:?}-]/g;-const CADDY_PLACEHOLDER_PATTERN = /\{\$([A-Z][A-Z0-9_]*)[:}]/g;-const DECLARATION_PATTERN = /^#?([A-Z][A-Z0-9_]*)=/gm;-const ACTIVE_DECLARATION_PATTERN = /^([A-Z][A-Z0-9_]*)=/gm;-const LINE_DECLARATION_PATTERN = /^#?([A-Z][A-Z0-9_]*)=(.*)$/u;-const LINE_REFERENCE_PATTERN = /\$\{?([A-Z][A-Z0-9_]*)/gu;--const read = (name: string) => readFileSync(path.join(SELF_HOSTING, name), 'utf8');--const composeFiles = readdirSync(SELF_HOSTING)- .filter((name) => name.endsWith('.yml'))- .sort();--const namesMatching = (source: string, pattern: RegExp) =>- new Set([...source.matchAll(pattern)].map(([, name]) => name));--const interpolatedNames = (source: string) => namesMatching(source, INTERPOLATION_PATTERN);--const example = read('.env.example');-const declared = new Set([...example.matchAll(DECLARATION_PATTERN)].map(([, name]) => name));--describe('.env.example covers every name the compose files interpolate', () => {- for (const file of composeFiles) {- test(`every \${NAME} in ${file} has a line in .env.example`, () => {- const missing = [...interpolatedNames(read(file))].filter((name) => !declared.has(name)).sort();- expect(missing).toEqual([]);- });- }-- test('every {$NAME} in the Caddyfile has a line in .env.example', () => {- const missing = [...namesMatching(read('Caddyfile'), CADDY_PLACEHOLDER_PATTERN)]- .filter((name) => !declared.has(name))- .sort();- expect(missing).toEqual([]);- });-- test('no name is assigned twice', () => {- const seen = new Set<string>();- const repeated = new Set<string>();- for (const [, name] of example.matchAll(ACTIVE_DECLARATION_PATTERN)) {- if (seen.has(name)) {- repeated.add(name);- }- seen.add(name);- }- expect([...repeated].sort()).toEqual([]);- });-- test('every name a .env.example line reads is declared above it', () => {- const lines = example.split('\n');- const declaredAt = new Map<string, number>();- lines.forEach((line, index) => {- const match = LINE_DECLARATION_PATTERN.exec(line);- if (match && !declaredAt.has(match[1])) {- declaredAt.set(match[1], index);- }- });- const unresolved: Array<string> = [];- lines.forEach((line, index) => {- const match = LINE_DECLARATION_PATTERN.exec(line);- if (!match) {- return;- }- for (const [, name] of match[2].matchAll(LINE_REFERENCE_PATTERN)) {- const at = declaredAt.get(name);- if (at === undefined || at > index) {- unresolved.push(`${match[1]} reads ${name}`);- }- }- });- expect(unresolved.sort()).toEqual([]);- });-});diff --git a/packages/config/src/__tests__/HelmChartParity.test.ts b/packages/config/src/__tests__/HelmChartParity.test.tsdeleted file mode 100644index b7e09c8f3..000000000--- a/packages/config/src/__tests__/HelmChartParity.test.ts+++ /dev/null@@ -1,42 +0,0 @@-// SPDX-License-Identifier: AGPL-3.0-or-later--import {readdirSync, readFileSync} from 'node:fs';-import path from 'node:path';-import {fileURLToPath} from 'node:url';-import {describe, expect, test} from 'vitest';--const REPO_ROOT = fileURLToPath(new URL('../../../../', import.meta.url));-const CHART = path.join(REPO_ROOT, 'deploy/helm/fluxer');-const CONFIGURATION_PAGE = path.join(REPO_ROOT, 'fluxer_docs/src/content/docs/operator/configuration.mdx');--const fixedWiringNames = (): Array<string> => {- const page = readFileSync(CONFIGURATION_PAGE, 'utf8');- const start = page.indexOf('#### Fixed wiring');- const end = page.indexOf('\n#### ', start + 1);- const section = page.slice(start, end);- return [...new Set([...section.matchAll(/`([A-Z][A-Z0-9_]*)`/g)].map(([, name]) => name))].sort();-};--const chartTemplates = (): string => {- const directory = path.join(CHART, 'templates');- return readdirSync(directory)- .filter((name) => name.endsWith('.yaml') || name.endsWith('.tpl'))- .map((name) => readFileSync(path.join(directory, name), 'utf8'))- .join('\n');-};--describe('the Helm chart matches the Compose stack', () => {- test('the chart ships the same Caddyfile as Compose', () => {- const compose = readFileSync(path.join(REPO_ROOT, 'deploy/self-hosting/Caddyfile'));- const chart = readFileSync(path.join(CHART, 'files/Caddyfile'));- expect(chart.equals(compose)).toBe(true);- });-- test('the chart sets every name Compose pins as fixed wiring', () => {- const names = fixedWiringNames();- expect(names.length).toBeGreaterThan(10);- const templates = chartTemplates();- const missing = names.filter((name) => !templates.includes(`"${name}"`));- expect(missing).toEqual([]);- });-});diff --git a/packages/config/src/__tests__/NonDefaultPortCompose.test.ts b/packages/config/src/__tests__/NonDefaultPortCompose.test.tsdeleted file mode 100644index 958d1df9a..000000000--- a/packages/config/src/__tests__/NonDefaultPortCompose.test.ts+++ /dev/null@@ -1,237 +0,0 @@-// SPDX-License-Identifier: AGPL-3.0-or-later--import {serviceEnvironment, serviceList, serviceNames} from '@fluxer/config/src/__tests__/SelfHostingCompose';-import {loadConfig, resetConfig} from '@fluxer/config/src/ConfigLoader';-import {normalizePublicEndpoint} from '@fluxer/config/src/EndpointDerivation';-import type {MasterConfig} from '@fluxer/config/src/MasterConfig';-import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest';--const DOMAIN = 'chat.example.com';-const PUBLIC_PORT = '19080';-const ORIGIN_PORT = '29080';--const SECRETS: Record<string, string> = {- FLUXER_DOMAIN: DOMAIN,- POSTGRES_PASSWORD: 'postgres-password',- MEILI_MASTER_KEY: 'meili-master-key',- FLUXER_S3_ACCESS_KEY: 's3-access-key',- FLUXER_S3_SECRET_KEY: 's3-secret-key',- LIVEKIT_API_KEY: 'livekit-api-key',- LIVEKIT_API_SECRET: 'livekit-api-secret',- FLUXER_ERLANG_COOKIE: 'erlang-cookie',- FLUXER_SUDO_MODE_SECRET: 'sudo-mode-secret',- FLUXER_CONNECTION_INITIATION_SECRET: 'connection-initiation-secret',- FLUXER_PROFILE_PSEUDONYM_SECRET: 'profile-pseudonym-secret',- FLUXER_GATEWAY_RPC_AUTH_TOKEN: 'gateway-rpc-auth-token',- FLUXER_MEDIA_PROXY_SECRET_KEY: 'media-proxy-secret-key',- FLUXER_MEDIA_PROXY_UPLOAD_RELAY_SECRET_BASE64: 'AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8=',- FLUXER_ADMIN_SECRET_KEY_BASE: 'admin-secret-key-base',- FLUXER_ADMIN_OAUTH_CLIENT_SECRET: 'admin-oauth-client-secret',- FLUXER_VAPID_PUBLIC_KEY: 'BB76bTFIuoqmxJtTfZX0yGTn1f_qu9H03B_nkj8OyExJFkN7Y-HBZZzShnHZoEhXKc5ZRy3jFu7OkBbnaQG-4aw',- FLUXER_VAPID_PRIVATE_KEY: 'Xgi-3P8J-I3Q6U1HlCcXMuc_tKLGAM9nIfznX3Hz68o',-};--const PORT_ONLY_ENV: Record<string, string> = {- ...SECRETS,- FLUXER_PUBLIC_SCHEME: 'http',- FLUXER_PUBLIC_PORT: PUBLIC_PORT,-};--const DOCUMENTED_RECIPE_ENV: Record<string, string> = {- ...PORT_ONLY_ENV,- FLUXER_PUBLIC_ORIGIN: `http://${DOMAIN}:${PUBLIC_PORT}`,- FLUXER_HTTP_PORT: PUBLIC_PORT,-};--const ORIGIN_ONLY_ENV: Record<string, string> = {- ...SECRETS,- FLUXER_PUBLIC_ORIGIN: `https://${DOMAIN}:${ORIGIN_PORT}`,- FLUXER_HTTPS_PORT: ORIGIN_PORT,-};--const SERVICES_WITHOUT_ENDPOINT_REPAIR = new Set(['edge']);--function closingBrace(value: string, open: number): number {- let depth = 0;- for (let index = open; index < value.length; index += 1) {- if (value[index] === '{') {- depth += 1;- } else if (value[index] === '}') {- depth -= 1;- if (depth === 0) {- return index;- }- }- }- throw new Error(`unbalanced interpolation in ${value}`);-}--function expand(value: string, env: Record<string, string>): string {- let out = '';- let index = 0;- while (index < value.length) {- const dollar = value.indexOf('$', index);- if (dollar === -1) {- return out + value.slice(index);- }- out += value.slice(index, dollar);- if (value[dollar + 1] !== '{') {- const bare = /^[A-Za-z_][A-Za-z0-9_]*/u.exec(value.slice(dollar + 1));- out += bare ? (env[bare[0]] ?? '') : '$';- index = dollar + 1 + (bare ? bare[0].length : 0);- continue;- }- const close = closingBrace(value, dollar + 1);- const inner = value.slice(dollar + 2, close);- const operator = inner.search(/:[-?+]/u);- const name = operator === -1 ? inner : inner.slice(0, operator);- const fallback = operator === -1 ? '' : inner.slice(operator + 2);- const current = env[name] ?? '';- if (current.length > 0) {- out += inner[operator + 1] === '+' && operator !== -1 ? expand(fallback, env) : current;- } else if (inner[operator + 1] === '-' && operator !== -1) {- out += expand(fallback, env);- } else if (inner[operator + 1] === '?' && operator !== -1) {- throw new Error(`${name} is required: ${fallback}`);- }- index = close + 1;- }- return out;-}--function expandedEnvironment(service: string, env: Record<string, string>): Record<string, string> {- const expanded: Record<string, string> = {};- for (const [key, value] of Object.entries(serviceEnvironment(service))) {- expanded[key] = expand(value, env);- }- return expanded;-}--function publicUrl(value: string): URL | null {- let parsed: URL;- try {- parsed = new URL(value);- } catch {- return null;- }- return parsed.hostname === DOMAIN ? parsed : null;-}--function publicUrlNames(environment: Record<string, string>): Array<string> {- return Object.keys(environment)- .filter((name) => publicUrl(environment[name]) !== null)- .sort();-}--function repairedPublicUrls(service: string, env: Record<string, string>): Array<[string, string]> {- const environment = expandedEnvironment(service, env);- const publicPort = Number.parseInt(environment.FLUXER_PUBLIC_PORT ?? '', 10);- return publicUrlNames(environment).map((name) => [- `${service}.${name}`,- normalizePublicEndpoint(- environment[name],- environment.FLUXER_BASE_DOMAIN ?? '',- Number.isNaN(publicPort) ? undefined : publicPort,- ),- ]);-}--function withoutPort(entries: Array<[string, string]>, port: string): Array<string> {- return entries- .filter(([, value]) => publicUrl(value)?.port !== port)- .map(([name, value]) => `${name}=${value}`)- .sort();-}--function publishedPorts(env: Record<string, string>): Array<string> {- return serviceList('edge', 'ports')- .map((mapped) => expand(mapped, env).split(':'))- .map((parts) => parts[parts.length - 2] ?? '');-}--function browserFacingUrls(config: MasterConfig): Array<[string, string]> {- const entries: Array<[string, string]> = [- ...Object.entries(config.endpoints),- ['integrations.voice.url', config.integrations.voice.url],- ['services.media_proxy.upload_relay.endpoint', config.services.media_proxy.upload_relay.endpoint],- ...config.auth.passkeys.additional_allowed_origins.map((origin, index): [string, string] => [- `auth.passkeys.additional_allowed_origins.${index}`,- origin,- ]),- ];- return entries.filter(([, value]) => publicUrl(value) !== null);-}--async function loadApiConfig(env: Record<string, string>): Promise<MasterConfig> {- for (const key of Object.keys(process.env)) {- if (key.startsWith('FLUXER_')) {- vi.stubEnv(key, undefined);- }- }- for (const [key, value] of Object.entries(expandedEnvironment('api', env))) {- if (key.startsWith('FLUXER_')) {- vi.stubEnv(key, value);- }- }- return loadConfig();-}--describe('the shipped compose stack expanded on a non-default port', () => {- test('every service handed a public URL is handed the base domain and port that repair it', () => {- const starved = serviceNames- .filter((service) => !SERVICES_WITHOUT_ENDPOINT_REPAIR.has(service))- .filter((service) => {- const environment = expandedEnvironment(service, PORT_ONLY_ENV);- return (- publicUrlNames(environment).length > 0 && (!environment.FLUXER_BASE_DOMAIN || !environment.FLUXER_PUBLIC_PORT)- );- });- expect(starved).toEqual([]);- });-- test('every public URL the stack hands a browser includes the port', () => {- const entries = serviceNames- .filter((service) => !SERVICES_WITHOUT_ENDPOINT_REPAIR.has(service))- .flatMap((service) => repairedPublicUrls(service, PORT_ONLY_ENV));- expect(entries.length).toBeGreaterThan(0);- expect(withoutPort(entries, PUBLIC_PORT)).toEqual([]);- });-- test('the edge listens on its scheme default whatever the public port is', () => {- const environment = expandedEnvironment('edge', PORT_ONLY_ENV);- expect(environment.FLUXER_EDGE_SITE_ADDRESS).toBe(`http://${DOMAIN}`);- expect(publishedPorts(PORT_ONLY_ENV)).not.toContain(PUBLIC_PORT);- });-- test('the documented recipe publishes the port every public URL advertises', () => {- expect(publishedPorts(DOCUMENTED_RECIPE_ENV)).toContain(PUBLIC_PORT);- });-});--describe('a public origin with a port while FLUXER_PUBLIC_PORT stays standard', () => {- beforeEach(() => {- resetConfig();- });-- afterEach(() => {- resetConfig();- vi.unstubAllEnvs();- });-- test('the compose overrides all include the origin port', () => {- const environment = expandedEnvironment('api', ORIGIN_ONLY_ENV);- const entries = publicUrlNames(environment).map((name): [string, string] => [name, environment[name]]);- expect(entries.length).toBeGreaterThan(0);- expect(withoutPort(entries, ORIGIN_PORT)).toEqual([]);- });-- test('the loaded config ports every public URL using the explicit origin', async () => {- const loaded = await loadApiConfig(ORIGIN_ONLY_ENV);- expect(withoutPort(browserFacingUrls(loaded), ORIGIN_PORT)).toEqual([]);- });-- test('the port-only recipe ports every public URL the loaded config exposes', async () => {- const loaded = await loadApiConfig(PORT_ONLY_ENV);- expect(withoutPort(browserFacingUrls(loaded), PUBLIC_PORT)).toEqual([]);- });-});diff --git a/packages/config/src/__tests__/SelfHostingCompose.ts b/packages/config/src/__tests__/SelfHostingCompose.tsdeleted file mode 100644index 4d59fb486..000000000--- a/packages/config/src/__tests__/SelfHostingCompose.ts+++ /dev/null@@ -1,53 +0,0 @@-import assert from 'node:assert/strict';-import {readFileSync} from 'node:fs';-import path from 'node:path';-import {fileURLToPath} from 'node:url';-import {type ConfigObject, isConfigObject} from '@fluxer/config/src/config_loader/ConfigObject';-import {parse} from 'yaml';--const SELF_HOSTING = fileURLToPath(new URL('../../../../deploy/self-hosting/', import.meta.url));--function readSelfHostingFile(name: string): string {- return readFileSync(path.join(SELF_HOSTING, name), 'utf8');-}--function mapping(value: unknown, name: string): ConfigObject {- assert.ok(isConfigObject(value), `${name} must be a mapping`);- return value;-}--const compose = mapping(parse(readSelfHostingFile('docker-compose.yml'), {merge: true}), 'docker-compose.yml');-const services = mapping(compose.services, 'services');-export const serviceNames = Object.keys(services);-assert.ok(serviceNames.length > 0, 'docker-compose.yml must define services');--export function composeService(name: string): ConfigObject {- return mapping(services[name], `services.${name}`);-}--function environment(value: unknown, name: string): Record<string, string> {- return Object.fromEntries(- Object.entries(mapping(value, name)).map(([key, entry]) => {- assert.ok(- typeof entry === 'string' || typeof entry === 'number' || typeof entry === 'boolean',- `${name}.${key} must have an explicit scalar value`,- );- return [key, String(entry)];- }),- );-}--export function serviceEnvironment(name: string): Record<string, string> {- const value = composeService(name).environment;- return value === undefined ? {} : environment(value, `services.${name}.environment`);-}--export function serviceList(name: string, key: string): Array<string> {- const value = composeService(name)[key];- assert.ok(Array.isArray(value), `services.${name}.${key} must be a list`);- assert.ok(- value.every((item) => typeof item === 'string'),- `services.${name}.${key} must contain strings`,- );- return value;-}diff --git a/packages/config/src/__tests__/SelfHostingComposeEnvironment.test.ts b/packages/config/src/__tests__/SelfHostingComposeEnvironment.test.tsdeleted file mode 100644index ea1181c18..000000000--- a/packages/config/src/__tests__/SelfHostingComposeEnvironment.test.ts+++ /dev/null@@ -1,106 +0,0 @@-// SPDX-License-Identifier: AGPL-3.0-or-later--import {serviceEnvironment, serviceNames} from '@fluxer/config/src/__tests__/SelfHostingCompose';-import {NAMED_FLUXER_ENV_NAMES} from '@fluxer/config/src/config_loader/EnvironmentOverrides';-import {describe, expect, test} from 'vitest';--const API_SETTINGS_NOT_FORWARDED: Record<string, string> = {- FLUXER_CASSANDRA_HOSTS: 'the stack runs Postgres only',- FLUXER_CASSANDRA_PORT: 'the stack runs Postgres only',- FLUXER_CASSANDRA_KEYSPACE: 'the stack runs Postgres only',- FLUXER_CASSANDRA_LOCAL_DC: 'the stack runs Postgres only',- FLUXER_CASSANDRA_USERNAME: 'the stack runs Postgres only',- FLUXER_CASSANDRA_PASSWORD: 'the stack runs Postgres only',- FLUXER_API_WORKER_MODE: 'the one worker container runs every lane',- FLUXER_API_WORKER_LANE: 'the one worker container runs every lane',- FLUXER_API_WORKER_TASK: 'the one worker container runs every lane',- FLUXER_API_WORKER_ENABLE_CRON_SCHEDULER: 'the one worker container hosts cron',- FLUXER_API_WORKER_METRICS_PORT: 'the stack scrapes no worker metrics',- FLUXER_RELAX_REGISTRATION_RATE_LIMITS: 'test and development only',- FLUXER_DISABLE_RATE_LIMITS: 'test and development only',- FLUXER_TEST_MODE_ENABLED: 'test and development only',- FLUXER_TEST_HARNESS_TOKEN: 'test and development only',- FLUXER_VALIDATE_RESPONSES: 'test and development only',- FLUXER_API_AUTOMATED_MESSAGE_DELETION_DELAY_DAYS: 'automated account actions run only on the hosted service',- ...Object.fromEntries(- ['MONTHLY', 'YEARLY', 'GIFT_1_MONTH', 'GIFT_1_YEAR'].flatMap((slot) =>- ['USD', 'EUR', 'BRL', 'DKK', 'INR', 'ISK', 'NOK', 'PLN', 'SEK', 'TRY'].map((currency) => [- `FLUXER_STRIPE_PRICE_${slot}_${currency}`,- 'FLUXER_STRIPE_PRICES or the dashboard sets prices',- ]),- ),- ),- ...Object.fromEntries(- NAMED_FLUXER_ENV_NAMES.filter((name) =>- ['FLUXER_APP_STORE_', 'FLUXER_GOOGLE_PLAY_', 'FLUXER_STORE_BILLING_'].some((prefix) => name.startsWith(prefix)),- ).map((name) => [name, 'in-app purchases are sold only by the hosted service']),- ),-};--const INPUT_NAMES: Record<string, string> = {- FLUXER_BASE_DOMAIN: 'FLUXER_DOMAIN',- FLUXER_POSTGRES_PASSWORD: 'POSTGRES_PASSWORD',- FLUXER_SEARCH_API_KEY: 'MEILI_MASTER_KEY',- FLUXER_S3_ACCESS_KEY_ID: 'FLUXER_S3_ACCESS_KEY',- FLUXER_S3_SECRET_ACCESS_KEY: 'FLUXER_S3_SECRET_KEY',- FLUXER_LIVEKIT_API_KEY: 'LIVEKIT_API_KEY',- FLUXER_LIVEKIT_API_SECRET: 'LIVEKIT_API_SECRET',- POSTGRES_DB: 'FLUXER_POSTGRES_DATABASE',- POSTGRES_USER: 'FLUXER_POSTGRES_USERNAME',- MEILI_ENV: 'FLUXER_MEILISEARCH_ENV',- MEILI_NO_ANALYTICS: 'FLUXER_MEILISEARCH_NO_ANALYTICS',- MEILI_MAX_INDEXING_MEMORY: 'FLUXER_MEILISEARCH_MAX_INDEXING_MEMORY',- MEILI_MAX_INDEXING_THREADS: 'FLUXER_MEILISEARCH_MAX_INDEXING_THREADS',- GOMEMLIMIT: 'FLUXER_SEAWEEDFS_GOMEMLIMIT',- WEED_MASTER_VOLUME_GROWTH_COPY_1: 'FLUXER_SEAWEEDFS_VOLUME_GROWTH',- LIVEKIT_KEYS: 'LIVEKIT_API_KEY',- NODE_EXTRA_CA_CERTS: 'FLUXER_NODE_EXTRA_CA_CERTS',-};--const OWN_POOL_SIZES = new Set(['api', 'worker', 'users-shard', 'messages-shard']);--const INTERPOLATION = /^\$\{([A-Z][A-Z0-9_]*)/u;--function inputName(service: string, key: string): string {- if (key === 'FLUXER_POSTGRES_MAX_CONNECTIONS' && OWN_POOL_SIZES.has(service)) {- return `FLUXER_${service.toUpperCase().replace('-', '_')}_POSTGRES_MAX_CONNECTIONS`;- }- return INPUT_NAMES[key] ?? key;-}--function forwardedEntries(): Array<{service: string; key: string; name: string}> {- return serviceNames.flatMap((service) =>- Object.entries(serviceEnvironment(service)).flatMap(([key, value]) => {- const match = INTERPOLATION.exec(value.trim());- if (match == null) {- return [];- }- return [{service, key, name: match[1]}];- }),- );-}--describe('the shipped compose stack forwards settings from .env', () => {- test('the api is handed every setting its config loader reads', () => {- const api = serviceEnvironment('api');- const missing = NAMED_FLUXER_ENV_NAMES.filter((name) => !(name in api) && !(name in API_SETTINGS_NOT_FORWARDED));- expect(missing).toEqual([]);- expect(Object.keys(API_SETTINGS_NOT_FORWARDED).filter((name) => !NAMED_FLUXER_ENV_NAMES.includes(name))).toEqual(- [],- );- });-- test('every forwarded setting is read from .env under the name the operator sets', () => {- const renamed = forwardedEntries()- .filter(({service, key, name}) => name !== inputName(service, key))- .map(({service, key, name}) => `${service}.${key} reads ${name}`);- expect(renamed).toEqual([]);- });-- test.each(['FLUXER_REPORT_RETENTION_DAYS', 'FLUXER_REPORT_RETENTION_DRY_RUN'])(- 'the worker is handed %s and gets no value when .env leaves it out',- (name) => {- expect(serviceEnvironment('worker')[name]).toBe(`\${${name}:-}`);- },- );-});diff --git a/packages/config/src/__tests__/SelfHostingObjectStoreAuth.test.ts b/packages/config/src/__tests__/SelfHostingObjectStoreAuth.test.tsdeleted file mode 100644index 8077e4e56..000000000--- a/packages/config/src/__tests__/SelfHostingObjectStoreAuth.test.ts+++ /dev/null@@ -1,46 +0,0 @@-// SPDX-License-Identifier: AGPL-3.0-or-later--import {composeService, serviceEnvironment, serviceList} from '@fluxer/config/src/__tests__/SelfHostingCompose';-import {describe, expect, test} from 'vitest';--describe('the shipped object store checks the credentials the stack sends', () => {- const entrypoint = serviceList('seaweedfs-init', 'entrypoint');- const init = entrypoint[2];-- test('seaweedfs-init applies an S3 identity built from the .env credentials', () => {- expect(entrypoint.slice(0, 2)).toEqual(['/bin/sh', '-c']);- expect(entrypoint).toHaveLength(3);- expect(init).toContain(- 's3.configure -user=fluxer -access_key=$$FLUXER_S3_ACCESS_KEY -secret_key=$$FLUXER_S3_SECRET_KEY',- );- expect(init).toContain('-apply');- });-- test('seaweedfs-init is handed the same credentials the api requires', () => {- for (const name of ['FLUXER_S3_ACCESS_KEY', 'FLUXER_S3_SECRET_KEY']) {- expect(serviceEnvironment('seaweedfs-init')[name]).toBe(`\${${name}:?set ${name} in .env}`);- }- });-- test('a failed identity write fails the init instead of leaving the store open', () => {- const configure = init.indexOf('s3.configure');- const ready = init.indexOf('echo "buckets ready"');- expect(configure).toBeGreaterThan(-1);- expect(ready).toBeGreaterThan(configure);- expect(init).toMatch(- /if ! echo "s3\.configure [^"]+"[^;]+; then\s+echo "seaweedfs-init could not configure the S3 identity" >&2;\s+exit 1;\s+fi;/u,- );- });-- test('media-proxy signs its reads, which the store now refuses to serve unsigned', () => {- expect(serviceEnvironment('media-proxy').FLUXER_S3_READ_SIGNED).toBe(`\${FLUXER_S3_READ_SIGNED:-true}`);- });-- test('every service that reaches the store waits for the identity to exist', () => {- for (const name of ['api', 'worker', 'media-proxy']) {- expect(composeService(name).depends_on, name).toMatchObject({- 'seaweedfs-init': {condition: 'service_completed_successfully'},- });- }- });-});