v1.0 - Version stable: multi-PC, détection UI-DETR-1, 3 modes exécution
- Frontend v4 accessible sur réseau local (192.168.1.40) - Ports ouverts: 3002 (frontend), 5001 (backend), 5004 (dashboard) - Ollama GPU fonctionnel - Self-healing interactif - Dashboard confiance Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
148
test_start_full_script.py
Normal file
148
test_start_full_script.py
Normal file
@@ -0,0 +1,148 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Test du Script start_full.sh
|
||||
Auteur : Dom, Alice, Kiro - 8 janvier 2026
|
||||
|
||||
Ce script teste le fonctionnement du script start_full.sh.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import time
|
||||
import requests
|
||||
import signal
|
||||
import os
|
||||
|
||||
class Colors:
|
||||
RED = '\033[0;31m'
|
||||
GREEN = '\033[0;32m'
|
||||
YELLOW = '\033[1;33m'
|
||||
BLUE = '\033[0;34m'
|
||||
PURPLE = '\033[0;35m'
|
||||
CYAN = '\033[0;36m'
|
||||
BOLD = '\033[1m'
|
||||
NC = '\033[0m'
|
||||
|
||||
def test_start_full_script(timeout: int = 60) -> bool:
|
||||
"""Teste le script start_full.sh"""
|
||||
print(f"{Colors.CYAN}🚀 Test du script start_full.sh...{Colors.NC}")
|
||||
|
||||
# Changer vers le répertoire VWB
|
||||
original_dir = os.getcwd()
|
||||
vwb_dir = os.path.join(original_dir, "visual_workflow_builder")
|
||||
|
||||
if not os.path.exists(vwb_dir):
|
||||
print(f"{Colors.RED}❌ Répertoire VWB non trouvé: {vwb_dir}{Colors.NC}")
|
||||
return False
|
||||
|
||||
try:
|
||||
os.chdir(vwb_dir)
|
||||
|
||||
print(f"{Colors.YELLOW}⏳ Lancement du script start_full.sh (timeout: {timeout}s)...{Colors.NC}")
|
||||
|
||||
process = subprocess.Popen(
|
||||
["./start_full.sh"],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
preexec_fn=os.setsid
|
||||
)
|
||||
|
||||
# Attendre que les services soient prêts
|
||||
start_time = time.time()
|
||||
backend_ready = False
|
||||
frontend_ready = False
|
||||
|
||||
while time.time() - start_time < timeout:
|
||||
# Tester le backend
|
||||
if not backend_ready:
|
||||
try:
|
||||
response = requests.get("http://localhost:5002/health", timeout=2)
|
||||
if response.status_code == 200:
|
||||
print(f"{Colors.GREEN}✅ Backend VWB prêt sur http://localhost:5002{Colors.NC}")
|
||||
backend_ready = True
|
||||
except requests.exceptions.RequestException:
|
||||
pass
|
||||
|
||||
# Tester le frontend
|
||||
if not frontend_ready:
|
||||
try:
|
||||
response = requests.get("http://localhost:3000", timeout=2)
|
||||
if response.status_code in [200, 404]: # 404 est OK pour React en dev
|
||||
print(f"{Colors.GREEN}✅ Frontend React prêt sur http://localhost:3000{Colors.NC}")
|
||||
frontend_ready = True
|
||||
except requests.exceptions.RequestException:
|
||||
pass
|
||||
|
||||
# Si les deux sont prêts, on peut arrêter
|
||||
if backend_ready and frontend_ready:
|
||||
break
|
||||
|
||||
# Vérifier si le processus est encore en vie
|
||||
if process.poll() is not None:
|
||||
stdout, stderr = process.communicate()
|
||||
print(f"{Colors.RED}❌ Le script s'est arrêté prématurément{Colors.NC}")
|
||||
print(f"STDOUT: {stdout.decode()[-1000:]}") # Derniers 1000 caractères
|
||||
print(f"STDERR: {stderr.decode()[-1000:]}")
|
||||
return False
|
||||
|
||||
time.sleep(2)
|
||||
|
||||
# Tester quelques endpoints du backend
|
||||
if backend_ready:
|
||||
endpoints_to_test = [
|
||||
("/health", "Health Check"),
|
||||
("/api/workflows", "Workflows API"),
|
||||
("/api/node-types", "Node Types API")
|
||||
]
|
||||
|
||||
for endpoint, description in endpoints_to_test:
|
||||
try:
|
||||
response = requests.get(f"http://localhost:5002{endpoint}", timeout=5)
|
||||
if response.status_code in [200, 404, 405]:
|
||||
print(f"{Colors.GREEN}✅ {description}: {endpoint} (status: {response.status_code}){Colors.NC}")
|
||||
else:
|
||||
print(f"{Colors.YELLOW}⚠️ {description}: {endpoint} (status: {response.status_code}){Colors.NC}")
|
||||
except Exception as e:
|
||||
print(f"{Colors.RED}❌ {description}: {endpoint} - Erreur: {e}{Colors.NC}")
|
||||
|
||||
# Arrêter le processus
|
||||
try:
|
||||
os.killpg(os.getpgid(process.pid), signal.SIGTERM)
|
||||
process.wait(timeout=10)
|
||||
except:
|
||||
os.killpg(os.getpgid(process.pid), signal.SIGKILL)
|
||||
|
||||
os.chdir(original_dir)
|
||||
|
||||
success = backend_ready and frontend_ready
|
||||
return success
|
||||
|
||||
except Exception as e:
|
||||
print(f"{Colors.RED}❌ Erreur lors du test: {e}{Colors.NC}")
|
||||
os.chdir(original_dir)
|
||||
return False
|
||||
|
||||
def main():
|
||||
"""Fonction principale"""
|
||||
print(f"{Colors.PURPLE}{Colors.BOLD}")
|
||||
print("╔════════════════════════════════════════════════════════════╗")
|
||||
print("║ 🧪 Test du Script start_full.sh ║")
|
||||
print("║ Auteur : Dom, Alice, Kiro - 8 janvier 2026 ║")
|
||||
print("╚════════════════════════════════════════════════════════════╝")
|
||||
print(f"{Colors.NC}")
|
||||
|
||||
success = test_start_full_script()
|
||||
|
||||
if success:
|
||||
print(f"\n{Colors.GREEN}{Colors.BOLD}🎉 SCRIPT start_full.sh FONCTIONNE CORRECTEMENT !{Colors.NC}")
|
||||
print(f"\n{Colors.CYAN}Le Visual Workflow Builder est maintenant prêt :{Colors.NC}")
|
||||
print(f" Frontend: http://localhost:3000")
|
||||
print(f" Backend: http://localhost:5002")
|
||||
print(f"\n{Colors.CYAN}Pour lancer manuellement :{Colors.NC}")
|
||||
print(f" cd visual_workflow_builder && ./start_full.sh")
|
||||
else:
|
||||
print(f"\n{Colors.RED}{Colors.BOLD}❌ PROBLÈME AVEC LE SCRIPT start_full.sh{Colors.NC}")
|
||||
print(f"Vérifiez les logs et les dépendances.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user