41 lines
1.8 KiB
Python
41 lines
1.8 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[3]
|
|
SCRIPT = ROOT / "scripts" / "reboot-recovery" / "post-start-quick-check.sh"
|
|
|
|
|
|
def test_post_start_self_checks_can_run_locally_on_110() -> None:
|
|
text = SCRIPT.read_text(encoding="utf-8")
|
|
|
|
assert "is_local_target()" in text
|
|
assert 'ips="$(local_ip_list)"' in text
|
|
assert 'local_ip_list | grep' not in text
|
|
assert 'bash -lc "$command"' in text
|
|
assert 'SSH_COMMAND_TIMEOUT_SECONDS="${SSH_COMMAND_TIMEOUT_SECONDS:-25}"' in text
|
|
assert 'SSH_TOTAL_TIMEOUT_SECONDS="${SSH_TOTAL_TIMEOUT_SECONDS:-$((SSH_CONNECT_TIMEOUT + SSH_COMMAND_TIMEOUT_SECONDS + 5))}"' in text
|
|
assert "printf -v quoted_command '%q' \"$command\"" in text
|
|
assert '-o ConnectionAttempts=1' in text
|
|
assert '-o ServerAliveInterval=5' in text
|
|
assert '-o ServerAliveCountMax=1' in text
|
|
assert '-o NumberOfPasswordPrompts=0' in text
|
|
assert "timeout ${SSH_COMMAND_TIMEOUT_SECONDS}s bash -lc ${quoted_command}" in text
|
|
assert 'run_with_timeout "$SSH_TOTAL_TIMEOUT_SECONDS" "${ssh_command[@]}"' in text
|
|
assert 'timeout --foreground --kill-after=3s "${timeout_seconds}s"' in text
|
|
|
|
|
|
def test_runner_pressure_is_capacity_evidence_after_routes_recover() -> None:
|
|
text = SCRIPT.read_text(encoding="utf-8")
|
|
|
|
assert "RUN_RUNNER_GUARD=1" in text
|
|
assert "--skip-runner-guard" in text
|
|
assert 'RUN_RUNNER_GUARD=0' in text
|
|
assert 'if [[ "$RUN_RUNNER_GUARD" -eq 1 ]]; then' in text
|
|
assert "110 runner fail-closed guard skipped by caller" in text
|
|
assert "service_route_recovered()" in text
|
|
assert "capacity_or_runner_issue()" in text
|
|
assert "cold-start non-route blockers retained as capacity/freshness evidence" in text
|
|
assert 'capacity_or_runner_issue "110 host pressure gate is blocking"' in text
|