test_unfinished_writes_during_shutdown: await add_last_node_task instead of cancelling it

asyncio cancel() only affects the client-side coroutine. The
server-side addserver handler in the cluster manager continues
running. If it can't complete (e.g. no raft quorum because the
target node is shut down), the orphaned handler blocks _after_test
cleanup for 120s.

Await the task instead so it completes cleanly (we restart the
target node first to restore quorum).
This commit is contained in:
Petr Gusev
2026-05-20 17:22:16 +02:00
parent fa01f74ae6
commit 32002f6443

View File

@@ -116,5 +116,5 @@ async def test_unfinished_writes_during_shutdown(request: pytest.FixtureRequest,
await manager.server_stop(target_server.server_id)
pytest.fail("Shutdown did not complete within 15s — deadlock reproduced")
logger.info("Cancelling addnode task")
add_last_node_task.cancel()
logger.info("Waiting for addnode to complete")
await add_last_node_task