-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_cache.sh
More file actions
executable file
·32 lines (22 loc) · 1.11 KB
/
test_cache.sh
File metadata and controls
executable file
·32 lines (22 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
echo "🚀 Testando servidor com cache habilitado..."
# Inicia o servidor em background
echo "Iniciando servidor na porta 3000..."
./bin/server -p 3000 &
SERVER_PID=$!
# Aguarda um pouco para o servidor inicializar
sleep 2
echo -e "\n📋 Fazendo primeira requisição (cache MISS esperado)..."
curl -s -I http://localhost:3000/data.json | grep -E "(X-Cache|Content-Type|Content-Length)"
echo -e "\n📋 Fazendo segunda requisição (cache HIT esperado)..."
curl -s -I http://localhost:3000/data.json | grep -E "(X-Cache|Content-Type|Content-Length)"
echo -e "\n📋 Testando página de teste de MIME types..."
curl -s -I http://localhost:3000/mime-test.html | grep -E "(X-Cache|Content-Type|Content-Length)"
echo -e "\n📋 Testando arquivo XML..."
curl -s -I http://localhost:3000/config.xml | grep -E "(X-Cache|Content-Type|Content-Length)"
echo -e "\n📋 Segunda requisição do XML (cache HIT esperado)..."
curl -s -I http://localhost:3000/config.xml | grep -E "(X-Cache|Content-Type|Content-Length)"
echo -e "\n🛑 Parando servidor..."
kill $SERVER_PID
wait $SERVER_PID 2>/dev/null
echo "✅ Teste concluído!"