Treize packs materiel : baies de disques, commutateurs, wifi
This commit is contained in:
1 parent
3879b63a88
commit
d2f11c3879
60 files changed
+1242
-2
No files matched your search
@@ -136,3 +136,17 @@ def test_accueil_et_mentions():
|
||||
assert b"Donn" in mentions.data # section donnees personnelles
|
||||
|
||||
assert client.get("/editeur").status_code == 200
|
||||
|
||||
|
||||
def test_chaque_pack_produit_un_plan_valide():
|
||||
"""Un pack du catalogue doit s'importer et se generer sans erreur bloquante."""
|
||||
from enclume.packs import pack_to_project
|
||||
|
||||
catalogue = Catalog("catalog")
|
||||
fautifs = {}
|
||||
for pack in catalogue.packs.values():
|
||||
plan = build_plan(pack_to_project(pack))
|
||||
erreurs = [i["message"] for i in plan.issues if i["level"] == "error"]
|
||||
if erreurs:
|
||||
fautifs[pack.id] = erreurs
|
||||
assert not fautifs, fautifs
|
||||
@@ -371,3 +371,64 @@ def test_blocs_par_defaut_exposes(app):
|
||||
blocs = reponse.get_json()
|
||||
assert any(b["valeur"] == "$HOSTOUTPUT$" for b in blocs)
|
||||
assert not any(b["valeur"] == "$SERVICEDESC$" for b in blocs)
|
||||
|
||||
|
||||
# ------------------------------------------------- chaine livree par les packs
|
||||
|
||||
def test_chaque_pack_declare_sa_chaine_de_notification():
|
||||
"""Un pack qui superviserait sans prevenir personne n'a pas d'interet."""
|
||||
from enclume.catalog import Catalog
|
||||
|
||||
catalogue = Catalog("catalog")
|
||||
sans = [p.id for p in catalogue.packs.values() if not p.notification]
|
||||
assert not sans, f"packs sans notification : {sans}"
|
||||
|
||||
for pack in catalogue.packs.values():
|
||||
notification = pack.notification
|
||||
assert notification.get("calendrier"), pack.id
|
||||
assert notification.get("groupe", "").startswith("CG-"), pack.id
|
||||
assert notification.get("impact"), pack.id
|
||||
|
||||
|
||||
def test_import_d_un_pack_rattache_ses_modeles():
|
||||
from enclume.catalog import Catalog
|
||||
from enclume.packs import pack_to_project
|
||||
|
||||
projet = pack_to_project(Catalog("catalog").get("app-ldap"))
|
||||
perimetre = projet.perimetres[0]
|
||||
|
||||
assert perimetre.calendrier == "24x7"
|
||||
assert perimetre.groupe == "CG-App-LDAP"
|
||||
assert perimetre.criticite == "Critique"
|
||||
assert projet.host_templates[0].perimetre == perimetre.name
|
||||
assert all(s.perimetre == perimetre.name for s in projet.service_templates)
|
||||
|
||||
|
||||
def test_les_calendriers_livres_par_centreon_ne_sont_pas_recrees():
|
||||
"""24x7 existe des l'installation : TP;ADD echouerait sur un objet existant."""
|
||||
from enclume.catalog import Catalog
|
||||
from enclume.packs import pack_to_project
|
||||
|
||||
projet = pack_to_project(Catalog("catalog").get("app-ldap"))
|
||||
assert projet.calendriers == []
|
||||
assert projet.perimetres[0].calendrier == "24x7"
|
||||
|
||||
# Un calendrier qui n'est pas livre, lui, doit etre cree.
|
||||
imprimante = pack_to_project(Catalog("catalog").get("hw-printer-rfc3805"))
|
||||
assert [c.name for c in imprimante.calendriers] == ["Heures-Ouvrees"]
|
||||
|
||||
|
||||
def test_un_pack_importe_produit_le_cablage_complet():
|
||||
from enclume.catalog import Catalog
|
||||
from enclume.packs import pack_to_project
|
||||
|
||||
projet = pack_to_project(Catalog("catalog").get("app-mysql"))
|
||||
lignes = lignes_clapi(projet)
|
||||
|
||||
assert any(ligne.startswith("CG;ADD;CG-App-DB-MySQL;") for ligne in lignes)
|
||||
assert any(
|
||||
ligne.startswith("HTPL;setcontactgroup;App-DB-MySQL-custom;CG-App-DB-MySQL")
|
||||
for ligne in lignes
|
||||
)
|
||||
assert any("STPL;setcontactgroup;" in ligne for ligne in lignes)
|
||||
assert any("notification_period;24x7" in ligne for ligne in lignes)
|
||||
Reference in new issue
Block a user