Spaces:
Sleeping
Sleeping
File size: 1,884 Bytes
de63014 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
#!/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()
|