Avatar / test_services.py
DataSage12's picture
Initial commit - HOLOKIA-AVATAR v2.2
de63014
#!/usr/bin/env python3
"""
Script de test pour vérifier que tous les services backend sont accessibles
"""
import requests
import json
import time
def test_service(name, url, method="GET", data=None):
"""Teste un service backend"""
try:
if method == "GET":
response = requests.get(url, timeout=5)
elif method == "POST":
response = requests.post(url, json=data, timeout=5)
if response.status_code == 200:
print(f"✅ {name}: OK (status {response.status_code})")
return True
else:
print(f"❌ {name}: Erreur (status {response.status_code})")
return False
except Exception as e:
print(f"❌ {name}: Erreur de connexion - {e}")
return False
def main():
print("🔍 Test des services backend...")
services = [
("TTS Health", "http://localhost:5000/health", "GET"),
("STT Health", "http://localhost:5001/health", "GET"),
("LLM Health", "http://localhost:5002/health", "GET"),
("Live Stream Health", "http://localhost:5003/health", "GET"),
]
all_ok = True
for name, url, method in services:
if not test_service(name, url, method):
all_ok = False
if all_ok:
print("\n🎉 Tous les services sont opérationnels!")
# Test d'un service TTS simple
print("\n🧪 Test TTS...")
tts_data = {"text": "Test", "lang": "fr"}
if test_service("TTS Generate", "http://localhost:5000/generate-tts", "POST", tts_data):
print("✅ TTS fonctionne correctement")
else:
print("❌ TTS ne fonctionne pas")
else:
print("\n⚠️ Certains services ne sont pas accessibles")
print("💡 Vérifiez que les services backend sont démarrés")
if __name__ == "__main__":
main()