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
34 lines
925 B
Python
34 lines
925 B
Python
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
|