Files
cv-site/test_ttl.sh
T
juanatsap 92dffe8c60 feat: add comprehensive testing infrastructure and security hardening
- Enhanced CI/CD pipeline with coverage reporting, benchmarks, and artifact uploads
- Implemented rate limiter IP validation with proxy support and spoofing protection
- Added extensive Makefile test targets for coverage, benchmarks, and continuous testing
- Expanded middleware chain with request validation, size limits, and suspicious activity logging
2025-11-11 21:43:12 +00:00

45 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
echo "=== Cache TTL Test ==="
echo "This test validates cache expiration (requires 5 second TTL)"
echo ""
echo "Step 1: Stop server and restart with 5 second TTL..."
# Kill existing server
lsof -ti:1999 | xargs kill -9 2>/dev/null || true
sleep 1
# Start server with short TTL for testing
CACHE_TTL_MINUTES=0.083333 ./cv-server > /tmp/cv-test.log 2>&1 &
SERVER_PID=$!
sleep 2
echo "Server started with PID: $SERVER_PID"
echo ""
echo "Step 2: Make initial request (cache miss expected)..."
curl -s http://localhost:1999/health | jq '.cache'
echo ""
echo "Step 3: Make request (cache hit expected)..."
curl -s -o /dev/null 'http://localhost:1999/?lang=en'
curl -s http://localhost:1999/health | jq '.cache'
echo ""
echo "Step 4: Wait 6 seconds for cache to expire..."
sleep 6
echo ""
echo "Step 5: Make request after expiration (cache miss expected)..."
curl -s -o /dev/null 'http://localhost:1999/?lang=en'
curl -s http://localhost:1999/health | jq '.cache'
echo ""
echo "Stopping test server..."
kill $SERVER_PID 2>/dev/null || true
wait $SERVER_PID 2>/dev/null || true
echo ""
echo "=== TTL Test Complete ==="
echo "Restart main server with: ./cv-server"