From d3e770254de0bb301815ca87257c8b1a357d06c4 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 26 Apr 2026 21:02:47 +0800 Subject: hehe --- tests/smoke.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 tests/smoke.sh (limited to 'tests') diff --git a/tests/smoke.sh b/tests/smoke.sh new file mode 100755 index 0000000..a5ef23d --- /dev/null +++ b/tests/smoke.sh @@ -0,0 +1,38 @@ +#!/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 <