Skip to content

Commit 90e954c

Browse files
committed
test: test_busy_threshold_endpoint on both NATS and TCP making sure info for rejection is working
Signed-off-by: Jacky <[email protected]>
1 parent a6ae490 commit 90e954c

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

tests/router/common.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import asyncio
55
import json
66
import logging
7+
import os
78
import random
89
import string
910
import time
@@ -38,6 +39,7 @@ def __init__(
3839
store_backend: str = "etcd",
3940
enforce_disagg: bool = False,
4041
busy_threshold: float | None = None,
42+
request_plane: str = "nats",
4143
):
4244
command = [
4345
"python3",
@@ -61,8 +63,12 @@ def __init__(
6163
if busy_threshold is not None:
6264
command.extend(["--busy-threshold", str(busy_threshold)])
6365

66+
env = os.environ.copy()
67+
env["DYN_REQUEST_PLANE"] = request_plane
68+
6469
super().__init__(
6570
command=command,
71+
env=env,
6672
timeout=60,
6773
display_output=True,
6874
health_check_ports=[frontend_port],
@@ -1895,6 +1901,7 @@ def _test_busy_threshold_endpoint(
18951901
frontend_port: int,
18961902
test_payload: dict,
18971903
store_backend: str = "etcd",
1904+
request_plane: str = "nats",
18981905
):
18991906
"""Test that the /busy_threshold endpoint can be hit and responds correctly.
19001907
@@ -1912,6 +1919,7 @@ def _test_busy_threshold_endpoint(
19121919
frontend_port: Port for the frontend HTTP server
19131920
test_payload: Base test payload (used to extract model name)
19141921
store_backend: Storage backend to use ("etcd" or "file"). Defaults to "etcd".
1922+
request_plane: Request plane to use ("nats" or "tcp"). Defaults to "nats".
19151923
19161924
Raises:
19171925
AssertionError: If endpoint responses are incorrect
@@ -1929,6 +1937,7 @@ def _test_busy_threshold_endpoint(
19291937
engine_workers.namespace,
19301938
store_backend,
19311939
busy_threshold=initial_threshold,
1940+
request_plane=request_plane,
19321941
)
19331942
kv_router.__enter__()
19341943

tests/router/test_router_e2e_with_mockers.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ def __init__(
175175
mocker_args: Optional[Dict[str, Any]] = None,
176176
num_mockers: int = 1,
177177
store_backend: str = "etcd",
178+
request_plane: str = "nats",
178179
):
179180
namespace_suffix = generate_random_suffix()
180181
self.namespace = f"test-namespace-{namespace_suffix}"
@@ -191,8 +192,12 @@ def __init__(
191192
mocker_args=mocker_args,
192193
)
193194

195+
env = os.environ.copy()
196+
env["DYN_REQUEST_PLANE"] = request_plane
197+
194198
self._process = ManagedProcess(
195199
command=command,
200+
env=env,
196201
timeout=60,
197202
display_output=True,
198203
health_check_ports=[],
@@ -649,8 +654,9 @@ def test_router_disagg_decisions(
649654

650655

651656
@pytest.mark.parallel
657+
@pytest.mark.parametrize("request_plane", ["nats", "tcp"], indirect=True)
652658
def test_busy_threshold_endpoint(
653-
request, runtime_services_session, predownload_tokenizers
659+
request, runtime_services_session, predownload_tokenizers, request_plane
654660
):
655661
"""Test that the /busy_threshold endpoint can be hit and responds correctly.
656662
@@ -661,14 +667,19 @@ def test_busy_threshold_endpoint(
661667
662668
For now, this test only verifies the endpoint is accessible and returns valid responses.
663669
"""
664-
logger.info("Starting busy_threshold endpoint test")
670+
logger.info(
671+
f"Starting busy_threshold endpoint test with request_plane={request_plane}"
672+
)
665673

666674
mocker_args = {"speedup_ratio": SPEEDUP_RATIO, "block_size": BLOCK_SIZE}
667675

668676
try:
669677
logger.info(f"Starting {NUM_MOCKERS} mocker instances")
670678
mockers = MockerProcess(
671-
request, mocker_args=mocker_args, num_mockers=NUM_MOCKERS
679+
request,
680+
mocker_args=mocker_args,
681+
num_mockers=NUM_MOCKERS,
682+
request_plane=request_plane,
672683
)
673684
logger.info(f"All mockers using endpoint: {mockers.endpoint}")
674685
mockers.__enter__()
@@ -681,6 +692,7 @@ def test_busy_threshold_endpoint(
681692
request=request,
682693
frontend_port=frontend_port,
683694
test_payload=TEST_PAYLOAD,
695+
request_plane=request_plane,
684696
)
685697

686698
finally:

0 commit comments

Comments
 (0)