fix: tests
Some checks failed
Build and Deploy JobMaker / build (push) Failing after 10s
Build and Deploy JobMaker / deploy (push) Has been skipped
Build and Deploy JobMaker / notify (push) Failing after 1s

This commit is contained in:
Ricardo Carneiro 2025-06-17 17:04:48 -03:00
parent 4472430633
commit c9efcd12c3

View File

@ -46,14 +46,42 @@ jobs:
# Iniciar container de teste
docker run -d --name test-container -p 8080:80 ${{ steps.meta.outputs.LATEST_TAG }}
# Aguardar container iniciar
sleep 10
# Aguardar nginx inicializar completamente
echo "⏳ Waiting for nginx to start..."
sleep 20
# Testar se está respondendo
curl -f http://localhost:8080 || exit 1
curl -f http://localhost:8080/robots.txt || exit 1
curl -f http://localhost:8080/sitemap.xml || exit 1
curl -f http://localhost:8080/en/ || exit 1
# Verificar se container está rodando
echo "📋 Container status:"
docker ps | grep test-container
# Mostrar logs para debug
echo "📋 Container logs:"
docker logs test-container
# Verificar se nginx está rodando
echo "🔍 Checking nginx process:"
docker exec test-container ps aux | grep nginx
# Teste interno primeiro (mais confiável)
echo "🔍 Testing internal connectivity:"
docker exec test-container wget -q --spider http://localhost/ && echo "✅ Internal test OK" || exit 1
# Teste externo com retry
echo "🔍 Testing external connectivity:"
for i in {1..5}; do
if curl -f http://localhost:8080; then
echo "✅ External test OK on attempt $i"
break
else
echo "⚠️ Attempt $i failed, retrying..."
sleep 5
fi
if [ $i -eq 5 ]; then
echo "❌ All attempts failed"
docker logs test-container
exit 1
fi
done
# Parar container de teste
docker stop test-container