Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions changelog.d/render-cancel-test-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Fixed

- **Render cancellation test waits longer and fails clearly.**
`test_local_backend_kills_the_container_on_cancellation` waited at most 10 s
for both fake theme containers and then cancelled anyway, so a loaded runner
could fail with a misleading "only one container killed" assertion. It now
waits up to 25 s and raises a clear timeout error when the containers never
start. Written by Google Jules; the race could not be reproduced locally.
(#12449)
Comment thread
MarkusNeusinger marked this conversation as resolved.
Resolved
7 changes: 6 additions & 1 deletion tests/unit/agents/runtime/test_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,10 +866,15 @@ async def test_local_backend_kills_the_container_on_cancellation(self, tmp_path:

task = asyncio.create_task(backend.render(job(job_id="cancelme")))
# Cancel once both theme containers run: a fixed sleep lost the race on a loaded CI runner.
for _ in range(200):
for _ in range(500):
if started.exists() and len(started.read_text().split()) == 2:
break
await asyncio.sleep(0.05)
else:
# Do not leave the render task and its fake containers to event-loop teardown.
task.cancel()
await asyncio.gather(task, return_exceptions=True)
raise RuntimeError("Timed out waiting for containers to start")
task.cancel()
with pytest.raises(asyncio.CancelledError):
await task
Expand Down
Loading