Skip to content

Commit cb5eb52

Browse files
committed
add potential deadlock test
1 parent 8e69ac6 commit cb5eb52

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ lint:
88
format:
99
uv run ruff format src tests
1010
uv run ruff check src tests --fix
11+
12+
test:
13+
uv run pytest tests

tests/test_communication.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,30 @@ async def test_ignore_flood_subscription(client: Client) -> None:
268268
timedelta(seconds=20),
269269
)
270270
assert response == "Hello, Alice!"
271+
272+
@pytest.mark.asyncio
273+
@pytest.mark.parametrize("handlers", [{**basic_rpc_method}])
274+
async def test_rpc_method_reconnect(client: Client) -> None:
275+
response = await client.send_rpc(
276+
"test_service",
277+
"rpc_method",
278+
"Alice",
279+
serialize_request,
280+
deserialize_response,
281+
deserialize_error,
282+
timedelta(seconds=20),
283+
)
284+
assert response == "Hello, Alice!"
285+
286+
await client._transport._close_all_sessions()
287+
response = await client.send_rpc(
288+
"test_service",
289+
"rpc_method",
290+
"Bob",
291+
serialize_request,
292+
deserialize_response,
293+
deserialize_error,
294+
timedelta(seconds=20),
295+
)
296+
297+
assert response == "Hello, Bob!"

0 commit comments

Comments
 (0)