Skip to content

Commit df10cbb

Browse files
committed
test: Increase subprocess timeout for complex concurrency tests
The multi-threaded and mixed concurrency tests can take longer on CI due to thread setup overhead and variable machine performance. - Add configurable timeout parameter to _run_subprocess_test - Use 20s timeout for multi-threaded test (4 threads) - Use 30s timeout for mixed concurrency test (3 threads × 3 tasks)
1 parent 2f5c0a9 commit df10cbb

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

tests/test_shutdown_stress.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,16 @@ async def main():
5151
"""
5252

5353

54-
def _run_subprocess_test(script_content: str, iterations: int = 10) -> None:
55-
"""Run a test script in subprocess multiple times to detect shutdown issues."""
54+
def _run_subprocess_test(
55+
script_content: str, iterations: int = 10, timeout: int = 10
56+
) -> None:
57+
"""Run a test script in subprocess multiple times to detect shutdown issues.
58+
59+
Args:
60+
script_content: The Python script to run.
61+
iterations: Number of times to run the script.
62+
timeout: Subprocess timeout in seconds per iteration (default 10).
63+
"""
5664
project_root = str(Path(__file__).parent.parent.resolve())
5765
env = os.environ.copy()
5866
env["PYTHONPATH"] = project_root
@@ -68,7 +76,7 @@ def _run_subprocess_test(script_content: str, iterations: int = 10) -> None:
6876
[sys.executable, "-u", script_path],
6977
capture_output=True,
7078
text=True,
71-
timeout=10,
79+
timeout=timeout,
7280
env=env,
7381
)
7482

@@ -253,7 +261,8 @@ def main():
253261
main()
254262
"""
255263

256-
_run_subprocess_test(script, iterations=10)
264+
# Use longer timeout (20s) for multi-threaded test due to thread setup overhead
265+
_run_subprocess_test(script, iterations=10, timeout=20)
257266

258267

259268
@pytest.mark.asyncio
@@ -316,4 +325,6 @@ def main():
316325
main()
317326
"""
318327

319-
_run_subprocess_test(script, iterations=10)
328+
# Use longer timeout (30s) for mixed concurrency test - most complex scenario
329+
# with multiple threads each running multiple async tasks
330+
_run_subprocess_test(script, iterations=10, timeout=30)

0 commit comments

Comments
 (0)