feat(api): expose harbor registry controlled recovery preflight
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
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
AI 技術雷達監控 / ai-technology-watch (push) Successful in 45s

This commit is contained in:
Your Name
2026-06-30 19:57:14 +08:00
parent 90647f294d
commit f429999acf
9 changed files with 1250 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
from pathlib import Path
ROOT = Path(__file__).resolve().parents[3]
WATCHDOG = ROOT / "scripts/reboot-recovery/harbor-watchdog.sh"
def test_harbor_watchdog_exposes_single_run_contracts() -> None:
text = WATCHDOG.read_text(encoding="utf-8")
assert "--check" in text
assert "--repair-once" in text
assert "AWOOOI_HARBOR_WATCHDOG_CHECK" in text
assert "mode=check" in text
assert "docker compose up -d harbor-log" in text
assert "docker compose up -d" in text
def test_harbor_watchdog_does_not_use_incident_grade_actions() -> None:
text = WATCHDOG.read_text(encoding="utf-8")
forbidden = [
"systemctl restart docker",
"service docker restart",
"\nreboot",
"\nsudo reboot",
"\nshutdown",
"\nsudo shutdown",
"docker system prune",
"docker volume rm",
]
for pattern in forbidden:
assert pattern not in text