34 lines
1.3 KiB
Bash
Executable File
34 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Smoke test V2: avvia container, verifica /health, /apidocs, e una tool con bearer testnet.
|
|
set -euo pipefail
|
|
|
|
PORT="${PORT:-9000}"
|
|
BASE="http://localhost:${PORT}"
|
|
|
|
echo "==> healthcheck"
|
|
curl -fsS "${BASE}/health" | python -m json.tool
|
|
|
|
echo "==> apidocs"
|
|
curl -fsS "${BASE}/apidocs" | grep -q "Cerbero MCP" && echo " swagger OK"
|
|
|
|
echo "==> openapi.json"
|
|
curl -fsS "${BASE}/openapi.json" | python -c "import sys,json;d=json.load(sys.stdin);assert 'BearerAuth' in d['components']['securitySchemes'];print(' bearer scheme OK')"
|
|
|
|
if [[ -z "${TESTNET_TOKEN:-}" ]]; then
|
|
echo "==> skip tool call (TESTNET_TOKEN non settato)"
|
|
exit 0
|
|
fi
|
|
|
|
echo "==> tool senza bearer → 401"
|
|
status=$(curl -s -o /dev/null -w "%{http_code}" -X POST "${BASE}/mcp-deribit/tools/get_ticker" \
|
|
-H "Content-Type: application/json" -d '{"instrument_name":"BTC-PERPETUAL"}')
|
|
[[ "$status" == "401" ]] && echo " 401 OK" || (echo " expected 401 got $status"; exit 1)
|
|
|
|
echo "==> tool con bearer testnet → routing testnet (può fallire 5xx se testnet down)"
|
|
curl -s -o /dev/null -w " http %{http_code}\n" -X POST "${BASE}/mcp-deribit/tools/get_ticker" \
|
|
-H "Authorization: Bearer ${TESTNET_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"instrument_name":"BTC-PERPETUAL"}'
|
|
|
|
echo "==> SMOKE OK"
|