Files
awoooi/scripts/reboot-recovery/tests/test_post_reboot_readiness_summary_contract.py

32 lines
1.3 KiB
Python

from __future__ import annotations
from pathlib import Path
ROOT = Path(__file__).resolve().parents[3]
SCRIPT = ROOT / "scripts" / "reboot-recovery" / "post-reboot-readiness-summary.sh"
def test_unknown_backup_escrow_evidence_stays_blocked() -> None:
text = SCRIPT.read_text(encoding="utf-8")
assert "POST_REBOOT_SKIP_RUNNER_GUARD" in text
assert 'post_start_args+=(--skip-runner-guard)' in text
assert "escrow_evidence_unknown=0" in text
assert 'elif [[ -z "$escrow_missing_count" ]]; then' in text
assert "escrow_evidence_unknown=1" in text
assert "DR_ESCROW_EVIDENCE_UNKNOWN=$escrow_evidence_unknown" in text
assert (
'[[ "$backup_core_green" != "1" ]] '
'&& next_required_gates+=("backup_core_readback_recovery")'
) in text
assert (
'[[ "$dr_escrow_blocked" == "1" ]] '
'&& next_required_gates+=("credential_escrow_evidence")'
) in text
assert 'POST_START_QUICK_CHECK_TIMEOUT_SECONDS="${POST_START_QUICK_CHECK_TIMEOUT_SECONDS:-90}"' in text
assert 'run_with_timeout "$POST_START_QUICK_CHECK_TIMEOUT_SECONDS"' in text
assert "POST_START_QUICK_CHECK_TIMEOUT=1" in text
assert "POST_START_TIMED_OUT=$post_start_timed_out" in text
assert 'next_required_gates+=("post_start_quick_check_timeout_recovery")' in text