Skip to content

Commit e8d9bdd

Browse files
jeffcrouseclaude
andcommitted
test: add uvicorn workers configuration check
Prevents regression where removing --workers from Dockerfile causes health check timeouts under load. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7e36d68 commit e8d9bdd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

backend/tests/test_migrations.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,22 @@ def test_docker_health_check_endpoint(client: TestClient) -> None:
156156
f"Health check endpoint {health_path} returned {response.status_code}. "
157157
f"Docker health checks will fail!"
158158
)
159+
160+
161+
def test_uvicorn_has_workers() -> None:
162+
"""Verify uvicorn is configured with multiple workers.
163+
164+
A single uvicorn process can become unresponsive under load, causing
165+
health checks to timeout even when the server is technically running.
166+
Multiple workers ensure there's always capacity to handle health checks.
167+
"""
168+
repo_root = Path(__file__).parent.parent.parent
169+
dockerfile_path = repo_root / "docker" / "Dockerfile"
170+
171+
dockerfile_content = dockerfile_path.read_text()
172+
173+
# Check that uvicorn CMD includes --workers
174+
assert "--workers" in dockerfile_content, (
175+
"uvicorn should be configured with --workers to prevent health check "
176+
"timeouts under load. Add '--workers', '4' to the CMD in Dockerfile."
177+
)

0 commit comments

Comments
 (0)