80 lines
2.9 KiB
Bash
Executable File
80 lines
2.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# ScriptsManager Proxy System - Quick Test Script
|
|
# Este script prueba el sistema de proxy implementado
|
|
|
|
echo "=== ScriptsManager Proxy System Test ==="
|
|
echo
|
|
|
|
# Verificar que el sistema esté ejecutándose
|
|
echo "1. Verificando que ScriptsManager esté activo..."
|
|
curl -s -f http://localhost:5003/health || {
|
|
echo "❌ ScriptsManager no está ejecutándose en puerto 5003"
|
|
echo " Ejecuta: docker compose --profile dev up scriptsmanager-dev"
|
|
exit 1
|
|
}
|
|
echo "✅ ScriptsManager está activo"
|
|
echo
|
|
|
|
# Probar endpoints de proxy
|
|
echo "2. Probando endpoint de estado de proxy..."
|
|
response=$(curl -s "http://localhost:5003/api/proxy/status?project_id=hydraulics&script_id=hammer_simulator_proxy&user_id=operator1")
|
|
echo " Respuesta: $response"
|
|
echo
|
|
|
|
# Iniciar un script proxy
|
|
echo "3. Iniciando script hammer_simulator_proxy..."
|
|
start_response=$(curl -s -X POST http://localhost:5003/api/proxy/start \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"project_id": "hydraulics", "script_id": "hammer_simulator_proxy", "user_id": "operator1"}')
|
|
echo " Respuesta: $start_response"
|
|
echo
|
|
|
|
# Esperar un momento para que el script se inicie
|
|
echo "4. Esperando 5 segundos para que el script se inicie..."
|
|
sleep 5
|
|
|
|
# Verificar estado después del inicio
|
|
echo "5. Verificando estado después del inicio..."
|
|
status_response=$(curl -s "http://localhost:5003/api/proxy/status?project_id=hydraulics&script_id=hammer_simulator_proxy&user_id=operator1")
|
|
echo " Estado: $status_response"
|
|
echo
|
|
|
|
# Intentar acceder al script directamente
|
|
echo "6. Intentando acceder al script proxy directamente..."
|
|
script_response=$(curl -s -w "\nHTTP Status: %{http_code}\n" "http://localhost:5003/project/hydraulics/script/hammer_simulator_proxy/user/operator1/")
|
|
echo " Respuesta del script:"
|
|
echo "$script_response"
|
|
echo
|
|
|
|
# Probar API del script
|
|
echo "7. Probando API de estado del script..."
|
|
api_response=$(curl -s "http://localhost:5003/project/hydraulics/script/hammer_simulator_proxy/user/operator1/api/status")
|
|
echo " API Status: $api_response"
|
|
echo
|
|
|
|
# Listar puertos en uso
|
|
echo "8. Verificando puertos en uso..."
|
|
ports_response=$(curl -s "http://localhost:5003/api/proxy/ports")
|
|
echo " Puertos: $ports_response"
|
|
echo
|
|
|
|
# Detener el script
|
|
echo "9. Deteniendo el script..."
|
|
stop_response=$(curl -s -X POST http://localhost:5003/api/proxy/stop \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"project_id": "hydraulics", "script_id": "hammer_simulator_proxy", "user_id": "operator1"}')
|
|
echo " Respuesta: $stop_response"
|
|
echo
|
|
|
|
echo "=== Test completado ==="
|
|
echo
|
|
echo "Para hacer más pruebas manuales:"
|
|
echo "- Abrir http://localhost:5003/dashboard en el navegador"
|
|
echo "- Iniciar scripts desde la interfaz web"
|
|
echo "- Acceder a scripts proxy en: http://localhost:5003/project/{project_id}/script/{script_id}/user/{user_id}/"
|
|
echo
|
|
echo "Logs disponibles en:"
|
|
echo "- logs/system/proxy_service.log"
|
|
echo "- logs/executions/{project_id}/{script_id}/{user_id}/"
|
|
echo "- docker compose logs scriptsmanager-dev" |