62 lines
1.7 KiB
Bash
Executable File
62 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Infrastructure Smoke Test — run before any deploy
|
|
# Exit codes: 0 = all pass, 1 = failures found
|
|
|
|
PASS=0
|
|
FAIL=0
|
|
|
|
check() {
|
|
local name="$1"
|
|
local cmd="$2"
|
|
if eval "$cmd" > /dev/null 2>&1; then
|
|
echo "✅ $name"
|
|
((PASS++))
|
|
else
|
|
echo "🔴 $name — FAILED"
|
|
((FAIL++))
|
|
fi
|
|
}
|
|
|
|
echo "=== Infrastructure Smoke Test ==="
|
|
echo ""
|
|
|
|
# ChromaDB v2 API
|
|
check "ChromaDB v2 API" "curl -sf http://192.168.86.25:8000/api/v2/tenants/default_tenant/databases/default_database/collections"
|
|
|
|
# ChromaDB v1 should be dead (verify we're not using it)
|
|
if curl -sf http://192.168.86.25:8000/api/v1/heartbeat > /dev/null 2>&1; then
|
|
echo "⚠️ ChromaDB v1 API is responding (should be dead) — check code for v1 usage"
|
|
fi
|
|
|
|
# Ollama
|
|
check "Ollama reachable" "curl -sf http://192.168.86.40:11434/api/tags"
|
|
|
|
# Ollama embeddings
|
|
check "Ollama embeddings" "curl -sf http://192.168.86.40:11434/api/embeddings -d '{\"model\":\"nomic-embed-text\",\"prompt\":\"test\"}'"
|
|
|
|
# SSH to GPU box
|
|
check "SSH to GPU box" "ssh -o ConnectTimeout=5 -o BatchMode=yes case@192.168.86.40 'echo OK'"
|
|
|
|
# Whisper on GPU box
|
|
check "Faster Whisper importable" "ssh -o ConnectTimeout=5 case@192.168.86.40 'source whisper-env/bin/activate && python3 -c \"from faster_whisper import WhisperModel; print(True)\"'"
|
|
|
|
# yt-dlp
|
|
check "yt-dlp installed" "/home/wdjones/.local/bin/yt-dlp --version"
|
|
|
|
# Docker
|
|
check "Docker running" "docker info"
|
|
|
|
# Knowledge Builder service
|
|
check "Knowledge Builder service" "systemctl --user is-active knowledge-builder.service"
|
|
|
|
# Knowledge Builder HTTP
|
|
check "Knowledge Builder HTTP" "curl -sf http://localhost:3001"
|
|
|
|
echo ""
|
|
echo "=== Results: $PASS passed, $FAIL failed ==="
|
|
|
|
if [ $FAIL -gt 0 ]; then
|
|
exit 1
|
|
fi
|
|
exit 0
|