245 lines
No EOL
6.6 KiB
Bash
245 lines
No EOL
6.6 KiB
Bash
#!/bin/bash
|
||
|
||
# 🧪 Veza Platform - Test Complet
|
||
# ===============================
|
||
|
||
echo "🧪 Test complet de Veza Platform"
|
||
echo "================================"
|
||
echo ""
|
||
|
||
# Couleurs pour l'affichage
|
||
RED='\033[0;31m'
|
||
GREEN='\033[0;32m'
|
||
YELLOW='\033[1;33m'
|
||
BLUE='\033[0;34m'
|
||
NC='\033[0m' # No Color
|
||
|
||
# Fonction pour afficher les résultats
|
||
print_result() {
|
||
if [ $1 -eq 0 ]; then
|
||
echo -e "${GREEN}✅ $2${NC}"
|
||
else
|
||
echo -e "${RED}❌ $2${NC}"
|
||
fi
|
||
}
|
||
|
||
print_info() {
|
||
echo -e "${BLUE}ℹ️ $1${NC}"
|
||
}
|
||
|
||
print_warning() {
|
||
echo -e "${YELLOW}⚠️ $1${NC}"
|
||
}
|
||
|
||
# Test 1: Vérifier que tous les services sont démarrés
|
||
echo "🔍 Test 1: Vérification des services..."
|
||
echo "----------------------------------------"
|
||
|
||
# Backend API
|
||
if curl -s http://localhost:8080/api/health > /dev/null; then
|
||
print_result 0 "Backend API (port 8080)"
|
||
else
|
||
print_result 1 "Backend API (port 8080)"
|
||
fi
|
||
|
||
# Frontend Web
|
||
if curl -s http://localhost:5176/ > /dev/null; then
|
||
print_result 0 "Frontend Web (port 5176)"
|
||
else
|
||
print_result 1 "Frontend Web (port 5176)"
|
||
fi
|
||
|
||
# PostgreSQL
|
||
if pg_isready -h localhost -p 5432 > /dev/null 2>&1; then
|
||
print_result 0 "PostgreSQL (port 5432)"
|
||
else
|
||
print_result 1 "PostgreSQL (port 5432)"
|
||
fi
|
||
|
||
# Redis
|
||
if redis-cli ping > /dev/null 2>&1; then
|
||
print_result 0 "Redis (port 6379)"
|
||
else
|
||
print_result 1 "Redis (port 6379)"
|
||
fi
|
||
|
||
# Chat Server
|
||
if curl -s http://localhost:3001/health > /dev/null 2>&1; then
|
||
print_result 0 "Chat Server (port 3001)"
|
||
else
|
||
print_result 1 "Chat Server (port 3001)"
|
||
fi
|
||
|
||
echo ""
|
||
|
||
# Test 2: Vérifier les réponses API
|
||
echo "🔍 Test 2: Vérification des réponses API..."
|
||
echo "--------------------------------------------"
|
||
|
||
# Test de l'endpoint health
|
||
HEALTH_RESPONSE=$(curl -s http://localhost:8080/api/health)
|
||
if echo "$HEALTH_RESPONSE" | grep -q "healthy"; then
|
||
print_result 0 "Endpoint /api/health"
|
||
echo " Réponse: $(echo "$HEALTH_RESPONSE" | jq -r '.status' 2>/dev/null || echo "JSON invalide")"
|
||
else
|
||
print_result 1 "Endpoint /api/health"
|
||
fi
|
||
|
||
# Test de l'endpoint users (si disponible)
|
||
if curl -s http://localhost:8080/api/users > /dev/null 2>&1; then
|
||
print_result 0 "Endpoint /api/users"
|
||
else
|
||
print_warning "Endpoint /api/users non disponible"
|
||
fi
|
||
|
||
echo ""
|
||
|
||
# Test 3: Vérifier l'interface web
|
||
echo "🔍 Test 3: Vérification de l'interface web..."
|
||
echo "---------------------------------------------"
|
||
|
||
# Vérifier que la page se charge
|
||
WEB_CONTENT=$(curl -s http://localhost:5176/)
|
||
if echo "$WEB_CONTENT" | grep -q "Veza Platform"; then
|
||
print_result 0 "Page d'accueil contient 'Veza Platform'"
|
||
else
|
||
print_result 1 "Page d'accueil ne contient pas 'Veza Platform'"
|
||
fi
|
||
|
||
# Vérifier que React se charge
|
||
if echo "$WEB_CONTENT" | grep -q "react"; then
|
||
print_result 0 "React détecté dans la page"
|
||
else
|
||
print_result 1 "React non détecté dans la page"
|
||
fi
|
||
|
||
echo ""
|
||
|
||
# Test 4: Vérifier la base de données
|
||
echo "🔍 Test 4: Vérification de la base de données..."
|
||
echo "------------------------------------------------"
|
||
|
||
# Test de connexion PostgreSQL
|
||
if psql -h localhost -U veza_user -d veza_local -c "SELECT 1;" > /dev/null 2>&1; then
|
||
print_result 0 "Connexion PostgreSQL réussie"
|
||
else
|
||
print_warning "Connexion PostgreSQL échouée (vérifiez les credentials)"
|
||
fi
|
||
|
||
# Test de connexion Redis
|
||
if redis-cli ping | grep -q "PONG"; then
|
||
print_result 0 "Connexion Redis réussie"
|
||
else
|
||
print_result 1 "Connexion Redis échouée"
|
||
fi
|
||
|
||
echo ""
|
||
|
||
# Test 5: Vérifier les processus en cours
|
||
echo "🔍 Test 5: Vérification des processus..."
|
||
echo "----------------------------------------"
|
||
|
||
# Vérifier les processus Node.js
|
||
NODE_PROCESSES=$(ps aux | grep -E "node.*vite" | grep -v grep | wc -l)
|
||
if [ $NODE_PROCESSES -gt 0 ]; then
|
||
print_result 0 "Processus Vite détectés ($NODE_PROCESSES)"
|
||
else
|
||
print_result 1 "Aucun processus Vite détecté"
|
||
fi
|
||
|
||
# Vérifier les processus Go
|
||
GO_PROCESSES=$(ps aux | grep -E "server" | grep -v grep | wc -l)
|
||
if [ $GO_PROCESSES -gt 0 ]; then
|
||
print_result 0 "Processus Backend détectés ($GO_PROCESSES)"
|
||
else
|
||
print_result 1 "Aucun processus Backend détecté"
|
||
fi
|
||
|
||
# Vérifier les processus Electron
|
||
ELECTRON_PROCESSES=$(ps aux | grep -E "electron" | grep -v grep | wc -l)
|
||
if [ $ELECTRON_PROCESSES -gt 0 ]; then
|
||
print_result 0 "Processus Electron détectés ($ELECTRON_PROCESSES)"
|
||
else
|
||
print_warning "Aucun processus Electron détecté (desktop non lancé)"
|
||
fi
|
||
|
||
echo ""
|
||
|
||
# Test 6: Vérifier les ports utilisés
|
||
echo "🔍 Test 6: Vérification des ports..."
|
||
echo "------------------------------------"
|
||
|
||
PORTS_TO_CHECK=(5176 8080 5432 6379 3001)
|
||
for port in "${PORTS_TO_CHECK[@]}"; do
|
||
if lsof -i :$port > /dev/null 2>&1; then
|
||
print_result 0 "Port $port ouvert"
|
||
else
|
||
print_result 1 "Port $port fermé"
|
||
fi
|
||
done
|
||
|
||
echo ""
|
||
|
||
# Test 7: Vérifier les fichiers de configuration
|
||
echo "🔍 Test 7: Vérification des fichiers de configuration..."
|
||
echo "-------------------------------------------------------"
|
||
|
||
# Vérifier les fichiers essentiels
|
||
FILES_TO_CHECK=(
|
||
"veza-frontend/package.json"
|
||
"veza-backend-api/go.mod"
|
||
"veza-desktop/package.json"
|
||
"docker-compose.production.yml"
|
||
"start-veza.sh"
|
||
"stop-veza.sh"
|
||
)
|
||
|
||
for file in "${FILES_TO_CHECK[@]}"; do
|
||
if [ -f "$file" ]; then
|
||
print_result 0 "Fichier $file présent"
|
||
else
|
||
print_result 1 "Fichier $file manquant"
|
||
fi
|
||
done
|
||
|
||
echo ""
|
||
|
||
# Résumé final
|
||
echo "📊 Résumé des tests"
|
||
echo "==================="
|
||
|
||
TOTAL_TESTS=0
|
||
PASSED_TESTS=0
|
||
|
||
# Compter les tests réussis (lignes avec ✅)
|
||
PASSED_TESTS=$(grep -c "✅" <<< "$(tail -n +50 $0)")
|
||
TOTAL_TESTS=$(grep -c "Test [0-9]" <<< "$(tail -n +50 $0)")
|
||
|
||
echo "Tests réussis: $PASSED_TESTS"
|
||
echo "Tests échoués: $((TOTAL_TESTS - PASSED_TESTS))"
|
||
echo ""
|
||
|
||
if [ $PASSED_TESTS -eq $TOTAL_TESTS ]; then
|
||
echo -e "${GREEN}🎉 Tous les tests sont passés ! Veza Platform est opérationnel.${NC}"
|
||
echo ""
|
||
echo "📱 Accès aux applications :"
|
||
echo " 🌐 Web App: http://localhost:5176"
|
||
echo " 🖥️ Desktop: ./start-desktop.sh"
|
||
echo ""
|
||
echo "🔧 Services actifs :"
|
||
echo " ✅ Backend API: http://localhost:8080"
|
||
echo " ✅ Frontend: http://localhost:5176"
|
||
echo " ✅ PostgreSQL: localhost:5432"
|
||
echo " ✅ Redis: localhost:6379"
|
||
echo " ✅ Chat Server: localhost:3001"
|
||
else
|
||
echo -e "${YELLOW}⚠️ Certains tests ont échoué. Vérifiez les services manquants.${NC}"
|
||
echo ""
|
||
echo "🔧 Commandes de dépannage :"
|
||
echo " - Redémarrer: ./start-veza.sh"
|
||
echo " - Arrêter: ./stop-veza.sh"
|
||
echo " - Logs: tail -f logs/*.log"
|
||
fi
|
||
|
||
echo ""
|
||
echo "🧪 Test complet terminé" |