48 lines
2.5 KiB
TypeScript
48 lines
2.5 KiB
TypeScript
import { readFileSync } from "node:fs";
|
||
import { join } from "node:path";
|
||
import { describe, expect, it } from "vitest";
|
||
|
||
describe("routage et persistance de déploiement", () => {
|
||
it("utilise le domaine fourni par l’environnement avec la recette comme repli", () => {
|
||
const composeFile = readFileSync(join(process.cwd(), "docker-compose.yml"), "utf8");
|
||
|
||
expect(composeFile).toContain(
|
||
"Host(`${APP_DOMAIN:-demat-facturation.recette.santinova-soft.org}`)"
|
||
);
|
||
expect(composeFile).toContain("source: demat_facturation_storage");
|
||
expect(composeFile).toContain("target: /app/storage");
|
||
});
|
||
|
||
it("refuse de recréer le volume PDF et contrôle son montage avant le démarrage", () => {
|
||
const composeFile = readFileSync(join(process.cwd(), "docker-compose.yml"), "utf8");
|
||
const dockerfile = readFileSync(join(process.cwd(), "Dockerfile"), "utf8");
|
||
const guardScript = readFileSync(join(process.cwd(), "scripts", "ensure-storage-volume.sh"), "utf8");
|
||
|
||
expect(composeFile).toContain("STORAGE_BASE_PATH: /app/storage");
|
||
expect(composeFile).toContain("external: true");
|
||
expect(composeFile).toContain("nocopy: true");
|
||
expect(composeFile).toContain("grep -qs ' /app/storage ' /proc/mounts");
|
||
expect(dockerfile).toContain('CMD ["/app/scripts/ensure-storage-volume.sh"]');
|
||
expect(guardScript).toContain("Volume persistant non monté");
|
||
expect(guardScript).toContain("/proc/mounts");
|
||
});
|
||
|
||
it("réserve le contrôle bloquant du volume aux environnements Santinova", () => {
|
||
const composeFile = readFileSync(join(process.cwd(), "docker-compose.yml"), "utf8");
|
||
const guardScript = readFileSync(join(process.cwd(), "scripts", "ensure-storage-volume.sh"), "utf8");
|
||
|
||
expect(composeFile).toContain('REQUIRE_STORAGE_VOLUME: "true"');
|
||
expect(guardScript).toContain('REQUIRE_STORAGE_VOLUME:-false');
|
||
expect(guardScript).toContain('mkdir -p "$storage_path"');
|
||
});
|
||
|
||
it("injecte uniquement les secrets serveur de la passerelle Référentiel IA", () => {
|
||
const composeFile = readFileSync(join(process.cwd(), "docker-compose.yml"), "utf8");
|
||
|
||
expect(composeFile).toContain("REFERENTIEL_IA_URL: ${REFERENTIEL_IA_URL:-https://referentiel-ia.recette.santinova-soft.org}");
|
||
expect(composeFile).toContain("REFERENTIEL_IA_TOKEN: ${REFERENTIEL_IA_TOKEN:-}");
|
||
expect(composeFile).toContain("REFERENTIEL_IA_TOKEN_FILE: /run/secrets/referentiel_ia_token");
|
||
expect(composeFile).toContain("file: /opt/manus-secrets/demat-facturation-referentiel-ia-token");
|
||
});
|
||
});
|