#!/usr/bin/env bash # Run inside an isolated test environment with a freshly migrated disposable DB. # No service creation, cleanup, miner commands, or production defaults. set -euo pipefail repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "${repo_root}/backend" [[ "${MINEROPS_STAGE_A_DISPOSABLE:-}" == 1 ]] || { echo "Require MINEROPS_STAGE_A_DISPOSABLE=1 and an isolated test database." >&2 exit 1 } export PYTHONDONTWRITEBYTECODE=1 export MINEROPS_ENABLE_REAL_REBOOT=false export MINEROPS_ENABLE_REAL_POWER_CONTROL=false python -c 'from app.config import settings; assert settings.postgres_db.startswith("minerops_stage_a_"), "Refusing non-Stage-A database"' python -m unittest -v \ tests.test_legacy_control_retirement \ tests.test_stage_a_containment \ tests.test_stage_a_containment_postgres \ tests.test_stage_a_delivery_evidence \ tests.test_stage_a_delivery_evidence_postgres \ tests.test_stage_a_schedule_cancellation_postgres \ tests.test_agent_zones_postgres \ tests.test_miner_control \ tests.test_agent_commands.AgentCommandServiceTests \ tests.test_agent_commands.AgentCommandRouterTests # Separately run agents/windows/tests/Test-MinerOpsControl.ps1 in a network-free # PowerShell environment, then Test-MinerOpsDiagnosticTransport.ps1. Both load # functions only. Diagnostic compatibility listeners bind loopback exclusively.