Files
speech/scripts/smoke_test.sh
du5t 89f8643426 Pin remaining unbounded deps, drop stale JS model-list fallback, add smoke test
pyannote.audio was still `>=3.1` — the same unbounded-constraint pattern
that silently broke qwen3 (transformers>=4.45.0 resolving to a version
without qwen3_asr support on a later rebuild). Confirmed it had already
drifted once this session (4.0.4 -> 4.0.7). Pinned to the exact version
the current diarization code (token=, .speaker_diarization) is verified
against.

asr.js's config-fetch failure path fabricated a hardcoded backend/model
list that could silently drift from the server's real one (this is
exactly how the wrong Qwen3-ASR-2B/8B model IDs stuck around). Replaced it
with a visible error instead of a second source of truth.

Added scripts/smoke_test.sh: hits every backend's /transcribe or
/synthesize directly with a synthetic clip. Every regression found this
session (wrong model IDs, pyannote API drift, cuDNN path conflict) would
have shown up here immediately instead of waiting for a user to hit it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 23:29:30 +09:00

51 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Minimal post-deploy smoke test. Hits every ASR/TTS worker's own endpoint
# directly (bypassing the gateway's OIDC auth) with a synthetic test clip, to
# catch startup/dependency/API-compat regressions before a user has to find
# them (qwen3's wrong model IDs, pyannote's use_auth_token/token rename, and
# the cuDNN LD_LIBRARY_PATH conflict all would have shown up here as an
# immediate FAIL instead of a silent break discovered later).
#
# Run this after every `bash build.sh` + redeploy.
set -uo pipefail
CONTAINER="${SPEECH_CONTAINER:-speech}"
TMP_WAV="/tmp/smoke_test_tone.wav"
FAIL=0
pass() { printf ' OK %s\n' "$1"; }
fail() { printf 'FAIL %s: %s\n' "$1" "$2"; FAIL=1; }
echo "=== generating synthetic test clip ==="
podman exec "$CONTAINER" ffmpeg -y -f lavfi -i "sine=frequency=440:duration=3" -ar 16000 -ac 1 "$TMP_WAV" >/dev/null 2>&1
echo "=== faster-whisper (8001) ==="
resp=$(podman exec "$CONTAINER" curl -s -o /dev/null -w "%{http_code}" -X POST http://127.0.0.1:8001/transcribe \
-F "file=@${TMP_WAV};type=audio/wav" -F "model=tiny" -F "language=ko")
[ "$resp" = "200" ] && pass "faster-whisper" || fail "faster-whisper" "HTTP $resp"
echo "=== qwen3 (8004) ==="
resp=$(podman exec "$CONTAINER" curl -s -o /dev/null -w "%{http_code}" -X POST http://127.0.0.1:8004/transcribe \
-F "file=@${TMP_WAV};type=audio/wav" -F "model=Qwen/Qwen3-ASR-0.6B-hf" -F "language=ko")
[ "$resp" = "200" ] && pass "qwen3" || fail "qwen3" "HTTP $resp"
echo "=== vibevoice (8006) ==="
resp=$(podman exec "$CONTAINER" curl -s -o /dev/null -w "%{http_code}" -X POST http://127.0.0.1:8006/transcribe \
-F "file=@${TMP_WAV};type=audio/wav" -F "model=microsoft/VibeVoice-ASR")
[ "$resp" = "200" ] && pass "vibevoice" || fail "vibevoice" "HTTP $resp"
echo "=== xtts (8005) ==="
resp=$(podman exec "$CONTAINER" curl -s -o /dev/null -w "%{http_code}" -X POST http://127.0.0.1:8005/synthesize \
-F "text=스모크 테스트입니다." -F "language=ko" -F "speaker_wav=${TMP_WAV}")
[ "$resp" = "200" ] && pass "xtts" || fail "xtts" "HTTP $resp"
podman exec "$CONTAINER" rm -f "$TMP_WAV"
echo
if [ "$FAIL" = "0" ]; then
echo "all backends OK"
else
echo "one or more backends FAILED — check: podman logs $CONTAINER"
fi
exit "$FAIL"