@@ -35,12 +35,52 @@ jobs:
3535 run : |
3636 set -euxo pipefail
3737
38- # Test server startup
39- docker run -d --name test-server -p 8000:8000 -e HOSTS=0.0.0.0:8000 glim-test
38+ # Generate health check token
39+ HEALTHCHECK_TOKEN=$(openssl rand -hex 64)
40+ echo "Generated health check token: ${HEALTHCHECK_TOKEN}"
41+
42+ # Test server startup with debug logging
43+ docker run -d --name test-server \
44+ -p 8000:8000 \
45+ -e HOSTS=0.0.0.0:8000 \
46+ -e HEALTHCHECK_TOKEN=${HEALTHCHECK_TOKEN} \
47+ -e RUST_LOG=debug \
48+ -e LOG_LEVEL=debug \
49+ glim-test
4050
4151 # Wait for server to start with retry logic
4252 for i in {1..30}; do
43- if curl -f -s http://0.0.0.0:8000/health > /dev/null 2>&1; then
53+ echo "Attempt $i: Testing health endpoint..."
54+
55+ # Test with verbose curl to see what's happening
56+ RESPONSE=$(curl -v -f -s -w "\nHTTP_CODE:%{http_code}\nTOTAL_TIME:%{time_total}\n" http://0.0.0.0:8000/health 2>&1) || {
57+ echo "Curl failed with exit code $?"
58+ echo "Full curl response:"
59+ echo "$RESPONSE"
60+
61+ # Check if it's a 401 (unauthorized)
62+ if echo "$RESPONSE" | grep -q "HTTP_CODE:401"; then
63+ echo "::error::Health endpoint returned 401 Unauthorized - authentication required"
64+ echo "=== Container logs ==="
65+ docker logs test-server
66+ echo "=== End container logs ==="
67+ exit 1
68+ fi
69+
70+ # Check if it's a timeout
71+ if echo "$RESPONSE" | grep -q "timeout\|Connection refused"; then
72+ echo "Connection timeout or refused - server may not be ready yet"
73+ else
74+ echo "::error::Unexpected curl error"
75+ echo "=== Container logs ==="
76+ docker logs test-server
77+ echo "=== End container logs ==="
78+ exit 1
79+ fi
80+ }
81+
82+ # Check if we got a successful response
83+ if echo "$RESPONSE" | grep -q "HTTP_CODE:200"; then
4484 echo "Server is ready after $i seconds"
4585 if [ $i -gt 8 ]; then
4686 echo "::warning::Server took longer than expected to start ($i seconds)"
@@ -58,21 +98,33 @@ jobs:
5898 sleep 1
5999 done
60100
61- # Test health endpoint
62- if ! curl -f http://0.0.0.0:8000/health; then
101+ # Test health endpoint with proper logging
102+ echo "Testing health endpoint..."
103+ if ! curl -v -f http://0.0.0.0:8000/health; then
63104 echo "::error::Health endpoint test failed"
105+ echo "=== Container logs ==="
106+ docker logs test-server
107+ echo "=== End container logs ==="
64108 exit 1
65109 fi
66110
67111 # Test main endpoint (should redirect)
68- if ! curl -f -I http://0.0.0.0:8000/; then
112+ echo "Testing main endpoint..."
113+ if ! curl -v -f -I http://0.0.0.0:8000/; then
69114 echo "::error::Main endpoint test failed"
115+ echo "=== Container logs ==="
116+ docker logs test-server
117+ echo "=== End container logs ==="
70118 exit 1
71119 fi
72120
73121 # Test image generation
74- if ! curl -f -o test-image.png -w "%{http_code}" http://0.0.0.0:8000/Xevion/Glim.png | grep -q "200"; then
122+ echo "Testing image generation..."
123+ if ! curl -v -f -o test-image.png -w "%{http_code}" http://0.0.0.0:8000/Xevion/Glim.png | grep -q "200"; then
75124 echo "::error::Image generation test failed"
125+ echo "=== Container logs ==="
126+ docker logs test-server
127+ echo "=== End container logs ==="
76128 exit 1
77129 fi
78130
0 commit comments