"""The one test that proves the timeout is real. `bash -c "sleep 300 & sleep 300"` is a miniature helm: a process that forks a child and waits on another. Kill the direct child only and the backgrounded `sleep` reparents to init and keeps running — which, when the process is helm, means a timed-out task retries while the original helm is still mutating the same release. This test needs a real process tree, so it lives in integration/. It needs no database: the `pool` fixture in conftest is not autouse. """ from __future__ import annotations import asyncio import subprocess import pytest from svcforge_core.adapters.helm import _run @pytest.mark.asyncio async def test_timeout_kills_the_whole_process_group() -> None: argv = ["bash", "-c", "sleep 300 & sleep 300"] # child forks a grandchild with pytest.raises(TimeoutError): await _run(argv, timeout_s=1) await asyncio.sleep(0.5) out = subprocess.run(["pgrep", "-f", "sleep 300"], capture_output=True, text=True) # noqa: S607 assert out.stdout.strip() == "", "grandchild survived: you killed the child, not the group"