目录
Seiji Eicher

[Serve] Add unit tests for NodePortManager (#61491)

Why

NodePortManager handles per-node port allocation for direct ingress replicas but has zero unit test coverage in OSS. Any regression in allocation, release, or cleanup logic would go undetected until integration tests or production.

What

Add test_node_port_manager.py covering:

  • HTTP/gRPC port allocation and release
  • Port reuse after release
  • Port blocking (post-release exclusion)
  • Re-allocation of an already-allocated replica (idempotency)
  • Cleanup/pruning of inactive replicas and stale node managers
  • Port exhaustion (NoAvailablePortError)
  • Invalid port release (wrong port number)
  • Concurrent allocation within a single node
  • Mixed-protocol allocation for the same replica
  • Blocked port persistence across allocation cycles
  • get_port error path for unallocated replicas

All tests use monkeypatched port ranges (5 ports each for HTTP/gRPC) to keep execution fast and deterministic.

Test plan

  • pytest python/ray/serve/tests/unit/test_node_port_manager.py -v — 11/11 passed locally

Signed-off-by: Seiji Eicher seiji@anyscale.com

1个月前29451次提交
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802032778号