[router] Add Rust Binary Entrypoint for SGLang Router (#9089)
This commit is contained in:
@@ -92,12 +92,8 @@ impl TestContext {
|
||||
// Create app context
|
||||
let app_context = common::create_test_context(config.clone());
|
||||
|
||||
// Create router using sync factory in a blocking context
|
||||
let router =
|
||||
tokio::task::spawn_blocking(move || RouterFactory::create_router(&app_context))
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
// Create router
|
||||
let router = RouterFactory::create_router(&app_context).await.unwrap();
|
||||
let router = Arc::from(router);
|
||||
|
||||
// Wait for router to discover workers
|
||||
@@ -1451,10 +1447,7 @@ mod pd_mode_tests {
|
||||
let app_context = common::create_test_context(config);
|
||||
|
||||
// Create router - this might fail due to health check issues
|
||||
let router_result =
|
||||
tokio::task::spawn_blocking(move || RouterFactory::create_router(&app_context))
|
||||
.await
|
||||
.unwrap();
|
||||
let router_result = RouterFactory::create_router(&app_context).await;
|
||||
|
||||
// Clean up workers
|
||||
prefill_worker.stop().await;
|
||||
|
||||
@@ -60,11 +60,7 @@ impl TestContext {
|
||||
config.mode = RoutingMode::Regular { worker_urls };
|
||||
|
||||
let app_context = common::create_test_context(config);
|
||||
let router =
|
||||
tokio::task::spawn_blocking(move || RouterFactory::create_router(&app_context))
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let router = RouterFactory::create_router(&app_context).await.unwrap();
|
||||
let router = Arc::from(router);
|
||||
|
||||
if !workers.is_empty() {
|
||||
|
||||
@@ -61,11 +61,7 @@ impl TestContext {
|
||||
config.mode = RoutingMode::Regular { worker_urls };
|
||||
|
||||
let app_context = common::create_test_context(config);
|
||||
let router =
|
||||
tokio::task::spawn_blocking(move || RouterFactory::create_router(&app_context))
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let router = RouterFactory::create_router(&app_context).await.unwrap();
|
||||
let router = Arc::from(router);
|
||||
|
||||
if !workers.is_empty() {
|
||||
|
||||
@@ -109,8 +109,8 @@ mod test_pd_routing {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_pd_router_configuration() {
|
||||
#[tokio::test]
|
||||
async fn test_pd_router_configuration() {
|
||||
// Test PD router configuration with various policies
|
||||
// In the new structure, RoutingMode and PolicyConfig are separate
|
||||
let test_cases = vec![
|
||||
@@ -190,7 +190,7 @@ mod test_pd_routing {
|
||||
let app_context =
|
||||
sglang_router_rs::server::AppContext::new(config, reqwest::Client::new(), 64);
|
||||
let app_context = std::sync::Arc::new(app_context);
|
||||
let result = RouterFactory::create_router(&app_context);
|
||||
let result = RouterFactory::create_router(&app_context).await;
|
||||
assert!(result.is_err());
|
||||
let error_msg = result.unwrap_err();
|
||||
// Error should be about health/timeout, not configuration
|
||||
|
||||
Reference in New Issue
Block a user