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:
152
test_backend_simple.py
Normal file
152
test_backend_simple.py
Normal file
@@ -0,0 +1,152 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test Simple du Backend Visual Workflow Builder
|
||||
|
||||
Auteur : Dom, Alice, Kiro - 08 janvier 2026
|
||||
|
||||
Test simplifié pour valider le fonctionnement du backend.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import time
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
def test_backend_startup():
|
||||
"""Test le démarrage du backend."""
|
||||
print("🧪 Test de démarrage du backend...")
|
||||
|
||||
try:
|
||||
# Démarrer le backend allégé
|
||||
env = os.environ.copy()
|
||||
env['PORT'] = '5004' # Port de test
|
||||
|
||||
process = subprocess.Popen(
|
||||
[sys.executable, 'app_lightweight.py'],
|
||||
cwd='visual_workflow_builder/backend',
|
||||
env=env,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True
|
||||
)
|
||||
|
||||
# Attendre le démarrage
|
||||
time.sleep(2)
|
||||
|
||||
# Vérifier que le processus est en vie
|
||||
if process.poll() is None:
|
||||
print("✅ Backend démarré avec succès")
|
||||
|
||||
# Arrêter le processus
|
||||
process.terminate()
|
||||
process.wait(timeout=5)
|
||||
print("✅ Backend arrêté proprement")
|
||||
return True
|
||||
else:
|
||||
stdout, stderr = process.communicate()
|
||||
print(f"❌ Échec du démarrage")
|
||||
print(f"STDOUT: {stdout[:200]}...")
|
||||
print(f"STDERR: {stderr[:200]}...")
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Erreur: {e}")
|
||||
return False
|
||||
|
||||
def test_files_exist():
|
||||
"""Vérifie que les fichiers essentiels existent."""
|
||||
print("🧪 Test de présence des fichiers...")
|
||||
|
||||
essential_files = [
|
||||
"visual_workflow_builder/backend/app_lightweight.py",
|
||||
"visual_workflow_builder/backend/start_fast.sh",
|
||||
"visual_workflow_builder/backend/models.py"
|
||||
]
|
||||
|
||||
all_exist = True
|
||||
for file_path in essential_files:
|
||||
if Path(file_path).exists():
|
||||
print(f"✅ {file_path}")
|
||||
else:
|
||||
print(f"❌ {file_path} manquant")
|
||||
all_exist = False
|
||||
|
||||
return all_exist
|
||||
|
||||
def test_script_executable():
|
||||
"""Vérifie que le script de démarrage est exécutable."""
|
||||
print("🧪 Test du script de démarrage...")
|
||||
|
||||
script_path = Path("visual_workflow_builder/backend/start_fast.sh")
|
||||
if script_path.exists():
|
||||
# Vérifier les permissions
|
||||
if os.access(script_path, os.X_OK):
|
||||
print("✅ Script exécutable")
|
||||
return True
|
||||
else:
|
||||
print("⚠️ Script non exécutable, correction...")
|
||||
os.chmod(script_path, 0o755)
|
||||
print("✅ Permissions corrigées")
|
||||
return True
|
||||
else:
|
||||
print("❌ Script manquant")
|
||||
return False
|
||||
|
||||
def main():
|
||||
"""Fonction principale."""
|
||||
print("=" * 60)
|
||||
print(" TEST SIMPLE BACKEND VWB")
|
||||
print("=" * 60)
|
||||
print("Auteur : Dom, Alice, Kiro - 08 janvier 2026")
|
||||
print()
|
||||
|
||||
tests = [
|
||||
("Fichiers essentiels", test_files_exist),
|
||||
("Script exécutable", test_script_executable),
|
||||
("Démarrage backend", test_backend_startup)
|
||||
]
|
||||
|
||||
passed = 0
|
||||
total = len(tests)
|
||||
|
||||
for test_name, test_func in tests:
|
||||
print(f"\n{'-'*40}")
|
||||
print(f" {test_name}")
|
||||
print(f"{'-'*40}")
|
||||
|
||||
if test_func():
|
||||
passed += 1
|
||||
print(f"✅ {test_name} - PASSÉ")
|
||||
else:
|
||||
print(f"❌ {test_name} - ÉCHOUÉ")
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print(" RÉSUMÉ")
|
||||
print("=" * 60)
|
||||
|
||||
success_rate = (passed / total) * 100
|
||||
print(f"Tests passés: {passed}/{total} ({success_rate:.1f}%)")
|
||||
|
||||
if passed == total:
|
||||
print("🎉 TOUS LES TESTS SONT PASSÉS!")
|
||||
print()
|
||||
print("Le backend Visual Workflow Builder est opérationnel.")
|
||||
print()
|
||||
print("Pour démarrer le backend:")
|
||||
print(" cd visual_workflow_builder/backend")
|
||||
print(" ./start_fast.sh")
|
||||
print()
|
||||
print("Endpoints disponibles:")
|
||||
print(" http://localhost:5002/health")
|
||||
print(" http://localhost:5002/api/workflows")
|
||||
return True
|
||||
else:
|
||||
print("⚠️ Certains tests ont échoué")
|
||||
print("Des corrections supplémentaires peuvent être nécessaires.")
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
success = main()
|
||||
sys.exit(0 if success else 1)
|
||||
Reference in New Issue
Block a user