Files
awoooi/scripts/ops/tests/test_host110_ollama_proxy_retirement_contract.py
ogt 4af6487ba6
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 2s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m31s
CD Pipeline / build-and-deploy (push) Successful in 15m18s
AWOOOI Harbor 110 Local Repair / workflow-shape (push) Successful in 1s
AWOOOI Harbor 110 Local Repair / harbor-110-local-repair (push) Successful in 22s
CD Pipeline / post-deploy-checks (push) Successful in 5m35s
fix(alerting): align Alertmanager metric schema
2026-07-16 18:01:47 +08:00

39 lines
1.3 KiB
Python

from __future__ import annotations
from pathlib import Path
ROOT = Path(__file__).resolve().parents[3]
SCRIPT = ROOT / "scripts" / "ops" / "retire-host110-ollama-proxy.sh"
def test_retirement_is_exact_bounded_and_rollback_capable() -> None:
text = SCRIPT.read_text(encoding="utf-8")
assert 'TRACE_ID="${TRACE_ID:?TRACE_ID is required}"' in text
assert 'RUN_ID="${RUN_ID:?RUN_ID is required}"' in text
assert 'WORK_ITEM_ID="${WORK_ITEM_ID:?WORK_ITEM_ID is required}"' in text
assert 'CONFIG_PATH="/etc/nginx/sites-enabled/110-ollama-proxy.conf"' in text
assert "flock -n 9" in text
assert "source_sha=" in text
assert "persistent_writes_performed=0" in text
assert "rollback_receipt" in text
assert "terminal=rollback_failed" in text
assert "sudo -n nginx -t" in text
assert "sudo -n systemctl reload nginx" in text
assert "completed_already_converged_no_write" in text
assert "state=already_retired" in text
def test_retirement_proves_the_retired_identity_cannot_reappear() -> None:
text = SCRIPT.read_text(encoding="utf-8")
assert "listener_11435=0" in text
assert "listener_11434=0" in text
assert "ollama_containers=0" in text
assert "stale_config_paths=0" in text
assert "grep -RIl" in text
assert "rm -rf" not in text
assert "pkill" not in text
assert "killall" not in text