Files
elmprodvpn/tests/transport_runbook_cli_smoke.sh

34 lines
914 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
RUNBOOK="${ROOT_DIR}/scripts/transport_runbook.py"
API_URL="${API_URL:-http://127.0.0.1:8080}"
if [[ ! -x "$RUNBOOK" ]]; then
if [[ -f "$RUNBOOK" ]]; then
chmod +x "$RUNBOOK"
else
echo "[transport_runbook_cli_smoke] missing runbook script: $RUNBOOK" >&2
exit 1
fi
fi
ts="$(date +%s)"
pid="$$"
client_id="smoke-runbook-${ts}-${pid}"
cfg='{"runner":"mock","runtime_mode":"exec"}'
echo "[transport_runbook_cli_smoke] API_URL=${API_URL}"
echo "[transport_runbook_cli_smoke] client_id=${client_id}"
env API_URL="${API_URL}" "$RUNBOOK" \
--api-url "${API_URL}" \
--client-id "${client_id}" \
--kind singbox \
--name "Runbook Smoke ${client_id}" \
--config-json "${cfg}" \
--actions "create,provision,start,health,metrics,restart,stop,delete"
echo "[transport_runbook_cli_smoke] passed"