Skip to content

Commit 04a39a4

Browse files
authored
[None][chore] enable test_ipc.py (#9865)
Signed-off-by: Yan Chunwei <[email protected]>
1 parent c76b428 commit 04a39a4

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

tests/integration/test_lists/test-db/l0_a10.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ l0_a10:
7878
- unittest/llmapi/test_additional_model_outputs.py -m "gpu1"
7979
# executor
8080
- unittest/executor/test_rpc.py
81+
- unittest/executor/test_ipc.py
8182
# trtllm-serve CPU-only
8283
- unittest/llmapi/apps/test_chat_utils.py
8384
- unittest/llmapi/apps/test_tool_parsers.py

tests/unittest/executor/test_ipc.py

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,100 @@ async def test_put_async_noblock(self):
538538
client.close()
539539
server.close()
540540

541+
@pytest.mark.asyncio
542+
async def test_async_router_without_hmac(self):
543+
"""Test async ROUTER socket without HMAC encryption."""
544+
server = ZeroMqQueue(
545+
address=None,
546+
socket_type=zmq.ROUTER,
547+
is_server=True,
548+
is_async=True,
549+
name="async_router_server_no_hmac",
550+
use_hmac_encryption=False,
551+
)
552+
553+
client = ZeroMqQueue(
554+
address=server.address,
555+
socket_type=zmq.DEALER,
556+
is_server=False,
557+
is_async=True,
558+
name="async_dealer_client_no_hmac",
559+
use_hmac_encryption=False,
560+
)
561+
562+
try:
563+
# Client sends async request
564+
request = {"async_request": "process_no_hmac"}
565+
await client.put_async(request)
566+
567+
# Server receives with identity
568+
received = await server.get_async()
569+
assert received == request
570+
571+
# Server replies
572+
response = {"async_response": "completed_no_hmac"}
573+
await server.put_async(response)
574+
575+
# Client receives
576+
received = await client.get_async()
577+
assert received == response
578+
finally:
579+
client.close()
580+
server.close()
581+
582+
@pytest.mark.asyncio
583+
async def test_async_router_get_noblock(self):
584+
"""Test get_async_noblock on ROUTER socket (handling multipart)."""
585+
server = ZeroMqQueue(
586+
address=None,
587+
socket_type=zmq.ROUTER,
588+
is_server=True,
589+
is_async=True,
590+
name="async_router_noblock_server",
591+
use_hmac_encryption=False,
592+
)
593+
594+
client = ZeroMqQueue(
595+
address=server.address,
596+
socket_type=zmq.DEALER,
597+
is_server=False,
598+
is_async=True,
599+
name="async_dealer_noblock_client",
600+
use_hmac_encryption=False,
601+
)
602+
603+
try:
604+
# Client sends async request
605+
request = {"noblock_request": "test"}
606+
607+
# Send with small delay to ensure we test the polling/waiting
608+
async def send_delayed():
609+
await asyncio.sleep(0.1)
610+
await client.put_async(request)
611+
612+
send_task = asyncio.create_task(send_delayed())
613+
614+
# Server receives using get_async_noblock
615+
# This exercises the ROUTER specific recv_multipart path
616+
received = await server.get_async_noblock(timeout=2.0)
617+
assert received == request
618+
619+
# Ensure identity was captured so we can reply
620+
assert server._last_identity is not None
621+
622+
# Server replies
623+
response = {"noblock_response": "done"}
624+
await server.put_async(response)
625+
626+
# Client receives
627+
received = await client.get_async()
628+
assert received == response
629+
630+
await send_task
631+
finally:
632+
client.close()
633+
server.close()
634+
541635

542636
class TestIpcPressureTest:
543637
"""Test performance and load handling."""

0 commit comments

Comments
 (0)