fix: supprimer les portails historiques et leur tuile
Some checks failed
Validation applicative / Tests de contrat (push) Failing after 6s

This commit is contained in:
manus-admin
2026-10-24 13:44:32 +00:00
parent 14eb1519bc
commit a64634d003
3 changed files with 17 additions and 25 deletions

View File

@@ -12,6 +12,8 @@ const root = path.join(__dirname, '..');
const html = fs.readFileSync(path.join(root, 'index.html'), 'utf8');
const compose = fs.readFileSync(path.join(root, 'docker-compose.yml'), 'utf8');
const script = html.match(/<script>([\s\S]*?)<\/script>/)?.[1];
const historicalRecetteHost = ['portail', 'recette', 'santinova-soft', 'org'].join('.');
const historicalProductionHost = ['portail', 'santinova-soft', 'org'].join('.');
assert.ok(script, 'le script de configuration des portails doit être présent');
assert.equal(/^(<<<<<<<|=======|>>>>>>>)/m.test(html), false, 'aucun marqueur de conflit Git ne doit être livré');
@@ -19,6 +21,8 @@ assert.match(html, /PORTAL_CONFIGS/, 'les domaines des portails doivent être co
assert.doesNotMatch(html, /class="entity-nav"/, 'un portail ne doit proposer aucun accès aux autres portails');
assert.doesNotMatch(html, /PORTAL_DEFINITIONS/, 'la liste de navigation croisée ne doit pas être livrée');
assert.doesNotMatch(html, /function renderNavigation\(/, 'aucune fonction ne doit construire des liens vers les autres portails');
assert.equal(html.includes(historicalRecetteHost), false, 'le portail historique recette ne doit plus être livré');
assert.equal(html.includes(historicalProductionHost), false, 'le portail historique production ne doit plus être livré');
assert.match(html, /STATUS_REFRESH_MS = 30000/, 'le délai de grisage doit être explicite');
assert.match(html, /setInterval\(fetchAndApplyStatuses, STATUS_REFRESH_MS\)/, 'les statuts doivent être réactualisés périodiquement');
@@ -102,18 +106,17 @@ for (const host of [hosts.itinovaRecette, hosts.soinsRecette, hosts.santinovaRec
`${host} doit avoir un routeur Traefik dédié`
);
}
assert.match(
compose,
/traefik\.http\.routers\.portail-legacy-recette\.rule=Host\(`portail\.recette\.santinova-soft\.org`\)/,
'l’ancienne URL recette doit garder un routeur de redirection'
);
assert.equal((compose.match(/tls\.certresolver=letsencrypt/g) || []).length, 5, 'chaque routeur recette doit demander un certificat TLS');
assert.equal(compose.includes(['portail', 'legacy'].join('-')), false, 'aucune route historique ne doit rester exposée');
assert.equal(compose.includes(historicalRecetteHost), false, 'l’ancienne URL recette ne doit plus être routée');
assert.equal(compose.includes(historicalProductionHost), false, 'l’ancienne URL production ne doit plus être routée');
assert.equal((compose.match(/tls\.certresolver=letsencrypt/g) || []).length, 4, 'seuls les quatre portails par entité doivent demander un certificat TLS');
const recetteApps = [
{ id: 'itinova-contacts', category: 'ITINOVA', urls: { recette: 'https://contacts.recette.santinova-soft.org' } },
{ id: 'gestion-astreintes-had', category: 'SOINS_ET_SANTE', urls: { recette: 'https://astreintes-had.recette.santinova-soft.org' } },
{ id: 'demat-facturation-dsi', category: 'SANTINOVA', urls: { recette: 'https://demat-facturation.recette.santinova-soft.org' } },
{ id: 'referentiel-ia', category: 'INFRA', urls: { recette: 'https://referentiel-ia.recette.santinova-soft.org' } },
{ id: 'portail-santinova', category: 'INFRA', urls: { recette: 'https://portail-santinova.recette.santinova-soft.org' } },
{ id: 'santelis-gestion', category: 'SANTINOVA', urls: { recette: 'https://gestion-santelis.recette.santinova-soft.org' } }
];
@@ -148,15 +151,10 @@ for (const imageName of ['budget-si.jpg', 'gestion-astreintes-had.jpg', 'gestion
assert.ok(fs.statSync(imagePath).size > 2048, `l’asset ${imageName} ne doit pas être vide`);
}
assert.deepEqual(
loadPortal('portail.recette.santinova-soft.org').redirects,
['https://portail-santinova.recette.santinova-soft.org/'],
'l’ancienne URL recette doit rediriger vers le portail Santinova'
);
assert.deepEqual(
loadPortal('portail.santinova-soft.org').redirects,
['https://portail-santinova.santinova-soft.org/'],
'l’ancienne URL production doit rediriger vers le portail Santinova'
);
for (const historicalHost of [historicalRecetteHost, historicalProductionHost]) {
const historicalPortal = loadPortal(historicalHost);
assert.equal(historicalPortal.sandbox.PORTAL, null, `${historicalHost} ne doit plus être reconnu comme portail`);
assert.deepEqual(historicalPortal.redirects, [], `${historicalHost} ne doit plus rediriger vers un portail`);
}
console.log('OK portal-contract');