Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions model_gateway/src/routers/http/pd_router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2282,6 +2282,10 @@ mod tests {
worker::{BasicWorkerBuilder, WorkerType},
};

/// Ceiling on a real HTTP round trip in these tests: a guard against a
/// hang, not a budget, since a loaded machine can take seconds.
const ROUND_TRIP_GUARD: std::time::Duration = std::time::Duration::from_secs(60);

fn create_test_pd_router() -> PDRouter {
let worker_registry = Arc::new(WorkerRegistry::new());
let policy_registry = Arc::new(PolicyRegistry::new(PolicyConfig::RoundRobin));
Expand Down Expand Up @@ -2724,7 +2728,7 @@ mod tests {
socket.write_all(response.as_bytes()).await.unwrap();
socket.shutdown().await.unwrap();
};
let (response, ()) = tokio::time::timeout(std::time::Duration::from_secs(5), async {
let (response, ()) = tokio::time::timeout(ROUND_TRIP_GUARD, async {
tokio::join!(
router.route_messages_count_tokens(
Some(&headers),
Expand Down Expand Up @@ -2947,14 +2951,14 @@ mod tests {
let tenant = TenantRequestMeta::new(TenantKey::new("test-tenant"));

let response = tokio::time::timeout(
std::time::Duration::from_secs(5),
ROUND_TRIP_GUARD,
router.route_chat(None, &tenant, streaming_chat(), UNKNOWN_MODEL_ID),
)
.await
.expect("the client stream must not wait for the prefill body");
assert_eq!(response.status(), StatusCode::OK);
let body = tokio::time::timeout(
std::time::Duration::from_secs(5),
ROUND_TRIP_GUARD,
axum::body::to_bytes(response.into_body(), usize::MAX),
)
.await
Expand All @@ -2965,12 +2969,12 @@ mod tests {
assert_eq!(decode.load(), 0);

release.notify_one();
let completed = tokio::time::timeout(std::time::Duration::from_secs(5), report_rx)
let completed = tokio::time::timeout(ROUND_TRIP_GUARD, report_rx)
.await
.expect("prefill body must be released")
.expect("probe report");
assert_eq!(completed, !fail_body);
tokio::time::timeout(std::time::Duration::from_secs(5), async {
tokio::time::timeout(ROUND_TRIP_GUARD, async {
while prefill.load() != 0 {
tokio::task::yield_now().await;
}
Expand Down
Loading