Files
serverAppConfigs/scripts/validate.sh
T

56 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Validation end-to-end test for vLLM on dankclaw
# Sends a simple prompt and measures total response time
# Usage: ./scripts/validate.sh [host] [port]
HOST="${1:-dankclaw}"
PORT="${2:-8000}"
MODEL="bottlecapai/ThinkingCap-Qwen3.6-27B-FP8"
echo "=== vLLM Validation Test ==="
echo "Target: ${HOST}:${PORT}"
echo "Model: ${MODEL}"
echo ""
START_TIME=$(date +%s%N)
RESPONSE=$(curl -s --max-time 60 -w "\n%{http_code}" \
"http://${HOST}:${PORT}/v1/chat/completions" \
-H "Content-Type: application/json" \
-d "{
\"model\": \"${MODEL}\",
\"messages\": [
{\"role\": \"user\", \"content\": \"What is 2 plus 2? Answer in one word.\"}
],
\"max_tokens\": 128,
\"temperature\": 0.1
}")
END_TIME=$(date +%s%N)
ELAPSED_MS=$(( (END_TIME - START_TIME) / 1000000 ))
HTTP_CODE=$(echo "$RESPONSE" | tail -1)
BODY=$(echo "$RESPONSE" | sed '$d')
echo "HTTP Status: ${HTTP_CODE}"
echo "Response Time: ${ELAPSED_MS}ms"
echo ""
if [ "$HTTP_CODE" = "200" ]; then
if [ "$ELAPSED_MS" -gt 60000 ]; then
echo "FAIL — Response time ${ELAPSED_MS}ms exceeds 60s limit"
echo "TIME=${ELAPSED_MS}"
exit 1
fi
CONTENT=$(echo "$BODY" | python3 -c "import sys,json; print(json.load(sys.stdin)['choices'][0]['message']['content'].strip())" 2>/dev/null)
echo "Model Output: ${CONTENT}"
echo ""
echo "PASS — Server responded successfully"
echo "TIME=${ELAPSED_MS}"
exit 0
else
echo "FAIL — Server returned HTTP ${HTTP_CODE}"
echo "Response: ${BODY}"
exit 1
fi