fiches : pas 5, les lecteurs du fichier de fiche suivent la filiation
index_attribue suit le chemin de la fiche (presentee, attribution du site, deposee) : sans lui la copie de reprise se regenerait sous l'index de production. site_ou_vit, depot_locataire et racines lisent la production dans parente.yml (underlay.site_de_production). Console et tests suivis. Conception et CHANGELOG 210. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
83fef75100
commit
f75f561183
9 changed files with 111 additions and 32 deletions
|
|
@ -69,6 +69,31 @@ class Fictif(unittest.TestCase):
|
|||
(self.d / "OPS-X" / "fiche-site.yml").unlink()
|
||||
self.assertEqual(inventory_rules.charger_nomenclature(self.d / "OPS-X" / "plan" / "nomenclature.yml")["index"], 23)
|
||||
|
||||
# 10. SANS FICHE DEPOSEE (2026-10-25, §2.5 pas 5) ------------------------------------
|
||||
# Le site ne depose plus sa fiche. La copie de reprise se regenerait alors sous l'index de
|
||||
# PRODUCTION (23) : `index_attribue` ne lisait que le fichier. Elle tient desormais son index du
|
||||
# site de reprise (son chemin le nomme), et la production le sien (sa filiation).
|
||||
def test_sans_fiche_la_copie_garde_l_index_de_reprise(self):
|
||||
(self.d / "OPS-X" / "fiche-site.yml").unlink()
|
||||
copie = self.d / "reprises" / "SITE-Reprise" / "OPS-X"
|
||||
ecrire(copie / "plan" / "nomenclature.yml", {"index": 23})
|
||||
ecrire(copie / "parente.yml", {"parente": {"depots": {"hebergeur": {"nom": "SITE-Prod"}}}})
|
||||
with mock.patch.object(contexte, "DOSSIER_ECOSYSTEMES", self.d):
|
||||
n = inventory_rules.charger_nomenclature(copie / "plan" / "nomenclature.yml")
|
||||
self.assertEqual((n["index"], n.get("index_production")), (43, 23))
|
||||
n = inventory_rules.charger_nomenclature(self.d / "OPS-X" / "plan" / "nomenclature.yml")
|
||||
self.assertEqual(n["index"], 23)
|
||||
|
||||
def test_sans_fiche_la_production_vit_chez_son_hebergeur(self):
|
||||
(self.d / "OPS-X" / "fiche-site.yml").unlink()
|
||||
self.assertEqual(underlay.site_de_production(self.d / "OPS-X"), "SITE-Prod")
|
||||
with mock.patch.object(devis_reseau, "DOSSIER_INSTANCES", self.d):
|
||||
self.assertEqual(devis_reseau.site_ou_vit("OPS-X"), "SITE-Prod")
|
||||
c = self.copie()
|
||||
(c / "fiche-site.yml").unlink(missing_ok=True)
|
||||
self.assertEqual(underlay.depot_locataire("OPS-X", self.d, "SITE-Reprise"), c)
|
||||
self.assertEqual(underlay.depot_locataire("OPS-X", self.d, "SITE-Prod"), self.d / "OPS-X")
|
||||
|
||||
# 2. ----------------------------------------------------------------------------------
|
||||
def test_l_hebergeur_attribue_la_production(self):
|
||||
self.assertEqual(contexte.Site(self.d / "SITE-Prod").ecarts_attribution(self.loc), [])
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class Decouverte(unittest.TestCase):
|
|||
self.assertEqual([m["ecosysteme"] for m in manquantes], ["OPS-Gamma"])
|
||||
self.assertIn("make ca-racine", manquantes[0]["remede"])
|
||||
|
||||
def test_console_d_ecosysteme_voit_son_site_par_la_copie_deposee(self):
|
||||
def test_console_d_ecosysteme_voit_son_site_par_sa_filiation(self):
|
||||
# Le serveur d'un ecosysteme ne porte pas le depot du site (mesure du 2026-10-18).
|
||||
pem = _une_racine()
|
||||
if not pem:
|
||||
|
|
@ -85,7 +85,9 @@ class Decouverte(unittest.TestCase):
|
|||
b = Path(d)
|
||||
(b / "OPS-Beta" / "plan").mkdir(parents=True)
|
||||
(b / "OPS-Beta" / "ac-racine-site.crt").write_text(pem)
|
||||
(b / "OPS-Beta" / "fiche-site.yml").write_text("site: SITE-Alpha\n")
|
||||
# Son site, par sa filiation : le site ne depose plus de fiche chez lui (2026-10-25, §2.5).
|
||||
(b / "OPS-Beta" / "parente.yml").write_text(
|
||||
"parente:\n depots:\n hebergeur:\n nom: SITE-Alpha\n")
|
||||
trouvees, _ = R.racines_connues(b)
|
||||
self.assertEqual([(r["id"], r["libelle"]) for r in trouvees], [("site-alpha", "site de Alpha")])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue