fix(agent): verify host110 harbor backend route
This commit is contained in:
@@ -448,7 +448,7 @@ _CATALOG: tuple[dict[str, Any], ...] = (
|
||||
"auto_apply_enabled": True,
|
||||
"approval_required": False,
|
||||
"risk_level": "medium",
|
||||
"catalog_revision": "2026-07-14-host110-inputs-v2",
|
||||
"catalog_revision": "2026-07-14-host110-harbor-route-v3",
|
||||
},
|
||||
{
|
||||
"catalog_id": "ansible:188-momo-backup-user",
|
||||
|
||||
@@ -109,7 +109,9 @@ _POSTCONDITION_REGISTRY: dict[str, tuple[AssetPostcondition, ...]] = {
|
||||
"host_110_harbor_route",
|
||||
"route",
|
||||
"host_110",
|
||||
"test -s /etc/nginx/sites-enabled/harbor.conf && systemctl is-active --quiet nginx",
|
||||
"status=$(curl -sS -o /dev/null -w '%{http_code}' --max-time 10 "
|
||||
"http://127.0.0.1:5000/v2/); "
|
||||
"[ \"$status\" = 200 ] || [ \"$status\" = 401 ]",
|
||||
),
|
||||
AssetPostcondition(
|
||||
"host_110_backup_assets",
|
||||
|
||||
@@ -16,6 +16,7 @@ from src.services.awooop_ansible_post_verifier import (
|
||||
AssetPostcondition,
|
||||
ReadOnlyProbeResult,
|
||||
build_read_only_probe_command,
|
||||
postconditions_for_catalog,
|
||||
registered_catalog_ids,
|
||||
run_ansible_asset_post_verifier,
|
||||
)
|
||||
@@ -51,6 +52,27 @@ def test_asset_postcondition_registry_covers_every_ansible_catalog() -> None:
|
||||
assert registered_catalog_ids() == catalog_ids
|
||||
|
||||
|
||||
def test_host110_harbor_postcondition_matches_registry_backend() -> None:
|
||||
catalog = next(
|
||||
item
|
||||
for item in list_ansible_catalog()
|
||||
if item["catalog_id"] == "ansible:110-devops"
|
||||
)
|
||||
condition = next(
|
||||
item
|
||||
for item in postconditions_for_catalog("ansible:110-devops")
|
||||
if item.condition_id == "host_110_harbor_route"
|
||||
)
|
||||
|
||||
assert "127.0.0.1:5000/v2/" in condition.probe
|
||||
assert "200" in condition.probe
|
||||
assert "401" in condition.probe
|
||||
assert "sites-enabled/harbor.conf" not in condition.probe
|
||||
assert catalog["catalog_revision"] == (
|
||||
"2026-07-14-host110-harbor-route-v3"
|
||||
)
|
||||
|
||||
|
||||
def test_read_only_probe_command_uses_structured_inventory(tmp_path: Path) -> None:
|
||||
root, key, known_hosts = _verifier_root(tmp_path)
|
||||
condition = AssetPostcondition(
|
||||
|
||||
Reference in New Issue
Block a user