Some checks failed
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / build-and-deploy (push) Has been cancelled
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / tests (push) Has been cancelled
80 lines
3.0 KiB
Python
80 lines
3.0 KiB
Python
import json
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[3]
|
|
|
|
|
|
def read(relative: str) -> str:
|
|
return (ROOT / relative).read_text(encoding="utf-8")
|
|
|
|
|
|
def test_agent99_config_covers_host188_edge_services_and_public_routes() -> None:
|
|
for name in ("agent99.config.example.json", "agent99.config.99.example.json"):
|
|
config = json.loads(read(name))
|
|
edge = config["edgeServiceRecovery"]
|
|
|
|
assert edge["enabled"] is True
|
|
assert edge["host"] == "192.168.0.188"
|
|
assert edge["scriptPath"] == "/home/ollama/bin/agent99-host188-edge-services-recover.sh"
|
|
assert set(edge["requiredServices"]) == {"n8n", "open-webui"}
|
|
assert "https://n8n.wooo.work" in config["publicUrls"]
|
|
assert "https://ollama.wooo.work" in config["publicUrls"]
|
|
|
|
|
|
def test_host188_recovery_uses_only_internal_pinned_images() -> None:
|
|
script = read("scripts/reboot-recovery/host188-edge-services-recover.sh")
|
|
|
|
assert "harbor.wooo.work/dockerhub-cache/n8nio/n8n@sha256:" in script
|
|
assert "harbor.wooo.work/ghcr-cache/open-webui/open-webui@sha256:" in script
|
|
assert "harbor.wooo.work/dockerhub-cache/library/alpine@sha256:" in script
|
|
assert "ghcr.io/" not in script
|
|
assert "docker.n8n.io/" not in script
|
|
assert ":latest" not in script
|
|
assert "external_registry_direct_pull" in script
|
|
|
|
|
|
def test_host188_check_mode_is_read_only_and_apply_is_bounded() -> None:
|
|
script = read("scripts/reboot-recovery/host188-edge-services-recover.sh")
|
|
check_block = script.split('if [[ "$MODE" == "check" ]]', 1)[1].split(
|
|
"exec 9>", 1
|
|
)[0]
|
|
|
|
for forbidden in (
|
|
"docker pull",
|
|
"docker run",
|
|
"docker compose",
|
|
"mkdir",
|
|
"mv ",
|
|
"chown",
|
|
"chmod",
|
|
"tee ",
|
|
):
|
|
assert forbidden not in check_block
|
|
|
|
assert "flock -w 30" in script
|
|
assert "snapshot_with_helper" in script
|
|
assert "--pull never" in script
|
|
assert '"secretValueRead":false' in script
|
|
assert '"rawDataRead":false' in script
|
|
assert '"automatic":false' in script
|
|
assert "host_reboot" in script
|
|
assert "vm_power_change" in script
|
|
|
|
|
|
def test_agent99_recover_binds_check_apply_verify_and_completion() -> None:
|
|
control = read("agent99-control-plane.ps1")
|
|
deploy = read("agent99-deploy.ps1")
|
|
playbook = read("infra/ansible/playbooks/188-ai-web.yml")
|
|
|
|
assert "function Invoke-AgentHost188EdgeRecovery" in control
|
|
assert 'New-AgentRecoveryPhase "host188_edge_services"' in control
|
|
assert 'New-AgentOutcomeCheck "host188_edge_services_ready"' in control
|
|
assert "$host188EdgeRecovery.runtimeWritePerformed" in control
|
|
assert "$host188EdgeRecovery.verified" in control
|
|
assert "container_local_upstream_and_public_https" in control
|
|
assert 'name = "canonical_public_route_coverage"' in deploy
|
|
assert "agent99-host188-edge-services-recover.sh --check" in playbook
|
|
assert "--work-item-id AIA-P0-006-EDGE-502-188" in playbook
|
|
assert "not ansible_check_mode" in playbook
|