Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
br3ndonland committed Jan 7, 2025
1 parent 319c07b commit eebb030
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ jobs:
export COVERAGE_PROCESS_START="$PWD/pyproject.toml"
hatch run ${{ env.HATCH_ENV }}:coverage run
timeout-minutes: 5
continue-on-error: true
- name: Enforce test coverage
run: |
hatch run ${{ env.HATCH_ENV }}:coverage combine -q
Expand Down
1 change: 1 addition & 0 deletions inboard/gunicorn_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def run(self) -> None:

async def callback_notify(self) -> None:
self.notify()
self.log.info("callback_notify ran")


class UvicornH11Worker(UvicornWorker):
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ classifiers = [
]
dependencies = [
"gunicorn==22.0.0",
"uvicorn==0.28.1",
"uvicorn==0.29.0",
]
description = "Docker images and utilities to power your Python APIs and help you ship faster."
dynamic = ["version"]
Expand Down Expand Up @@ -156,7 +156,7 @@ show_error_codes = true
strict = true

[tool.pytest.ini_options]
addopts = "-q"
addopts = "-vv"
markers = [
"subprocess: test requires a subprocess (deselect with '-m \"not subprocess\"')",
]
Expand Down
12 changes: 11 additions & 1 deletion tests/test_gunicorn_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def gunicorn_process(
An instance of `httpx.Client` is available on the `client` attribute.
Output is saved to a temporary file and accessed with `read_output()`.
"""
app_module = f"{__name__}:{app.__name__}"
app_module = "tests.test_gunicorn_workers:app"
bind = f"127.0.0.1:{unused_tcp_port}"
use_tls: bool = request.param
args = [
Expand All @@ -187,6 +187,8 @@ def gunicorn_process(
bind,
"--graceful-timeout",
"1",
"--timeout",
"4",
"--log-level",
"debug",
"--worker-class",
Expand Down Expand Up @@ -324,3 +326,11 @@ def test_uvicorn_worker_boot_error(
except AssertionError: # pragma: no cover
time.sleep(5)
assert process_has_terminated(process, expected_text=expected_text)


def test_uvicorn_worker_timeout(gunicorn_process: Process) -> None:
# WIP
time.sleep(5)
output_text = gunicorn_process.read_output()
assert "callback_notify" in output_text
assert "WORKER TIMEOUT" in output_text

0 comments on commit eebb030

Please sign in to comment.