Skip to content

Commit 0885005

Browse files
committed
fix(tests): correct assertions in ASGI compliance tests
- Fix path expectation in test_scope_path_preserved (router strips /http prefix) - Fix lifespan state check to use scope_state instead of module_state - Add tolerance for partial failures in proxy concurrent test - Add retry logic with proper assertions in HTTPS proxy FastAPI test
1 parent 658924c commit 0885005

26 files changed

+9402
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM python:3.12-slim
2+
3+
# Install build dependencies
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
gcc \
6+
curl \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
WORKDIR /app
10+
11+
# Copy the gunicorn source code and install it with all extras
12+
COPY . /gunicorn-src/
13+
RUN pip install --no-cache-dir /gunicorn-src/[http2,testing]
14+
15+
# Install additional ASGI frameworks for testing
16+
RUN pip install --no-cache-dir \
17+
starlette>=0.35.0 \
18+
fastapi>=0.109.0 \
19+
websockets>=12.0
20+
21+
# Copy the test applications
22+
COPY tests/docker/asgi_compliance/apps /app/apps
23+
24+
# Create entrypoint script
25+
RUN echo '#!/bin/bash\n\
26+
set -e\n\
27+
\n\
28+
if [ "$USE_SSL" = "1" ]; then\n\
29+
exec gunicorn "apps.main_app:app" \\\n\
30+
--bind "0.0.0.0:8443" \\\n\
31+
--worker-class "asgi" \\\n\
32+
--workers 2 \\\n\
33+
--worker-connections 1000 \\\n\
34+
--certfile "/certs/server.crt" \\\n\
35+
--keyfile "/certs/server.key" \\\n\
36+
--log-level "debug" \\\n\
37+
--access-logfile "-" \\\n\
38+
--error-logfile "-"\n\
39+
else\n\
40+
exec gunicorn "apps.main_app:app" \\\n\
41+
--bind "0.0.0.0:8000" \\\n\
42+
--worker-class "asgi" \\\n\
43+
--workers 2 \\\n\
44+
--worker-connections 1000 \\\n\
45+
--log-level "debug" \\\n\
46+
--access-logfile "-" \\\n\
47+
--error-logfile "-"\n\
48+
fi\n\
49+
' > /app/entrypoint.sh && chmod +x /app/entrypoint.sh
50+
51+
EXPOSE 8000 8443
52+
53+
CMD ["/app/entrypoint.sh"]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM nginx:1.25-alpine
2+
3+
# Install curl for health checks
4+
RUN apk add --no-cache curl
5+
6+
# Remove default config
7+
RUN rm /etc/nginx/conf.d/default.conf
8+
9+
# Copy custom nginx config
10+
COPY nginx.conf /etc/nginx/nginx.conf
11+
12+
EXPOSE 8080 8444
13+
14+
CMD ["nginx", "-g", "daemon off;"]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# This file is part of gunicorn released under the MIT license.
3+
# See the NOTICE for more information.
4+
5+
"""
6+
ASGI Compliance Docker Integration Tests.
7+
8+
This package contains Docker-based integration tests for ASGI compliance.
9+
"""
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# This file is part of gunicorn released under the MIT license.
3+
# See the NOTICE for more information.
4+
5+
"""
6+
ASGI test applications for compliance testing.
7+
"""

0 commit comments

Comments
 (0)