#!/usr/bin/env bash # Smoke test for the OpenAI-compatible LLM endpoint. # Usage: # ENDPOINT=http://llm.dev.localtest.me:8080 MODEL=Qwen2.5-0.5B-Instruct ./tests/smoke.sh set -euo pipefail ENDPOINT="${ENDPOINT:-http://llm.dev.localtest.me:8080}" MODEL="${MODEL:-Qwen2.5-0.5B-Instruct}" TIMEOUT="${TIMEOUT:-120}" say() { printf '\033[1;34m==>\033[0m %s\n' "$*"; } fail() { printf '\033[1;31mFAIL\033[0m %s\n' "$*" >&2; exit 1; } say "Endpoint: $ENDPOINT" say "Model: $MODEL" say "GET /v1/models" models_json="$(curl -fsS --max-time "$TIMEOUT" "$ENDPOINT/v1/models")" || fail "/v1/models unreachable" echo "$models_json" | grep -q "$MODEL" || fail "/v1/models does not list $MODEL" say "POST /v1/chat/completions" resp="$(curl -fsS --max-time "$TIMEOUT" "$ENDPOINT/v1/chat/completions" \ -H 'Content-Type: application/json' \ -d "$(cat <