[router] refactor router and worker management 2/n (#10666)
This commit is contained in:
@@ -207,19 +207,21 @@ mod test_pd_routing {
|
||||
history_backend: sglang_router_rs::config::HistoryBackend::Memory,
|
||||
};
|
||||
|
||||
// Router creation will fail due to health checks, but config should be valid
|
||||
let app_context =
|
||||
sglang_router_rs::server::AppContext::new(config, reqwest::Client::new(), 64, None)
|
||||
.expect("Failed to create AppContext");
|
||||
let app_context = std::sync::Arc::new(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
|
||||
assert!(
|
||||
error_msg.contains("healthy") || error_msg.contains("timeout"),
|
||||
"Unexpected error: {}",
|
||||
error_msg
|
||||
result.is_ok(),
|
||||
"Router creation should succeed with empty worker"
|
||||
);
|
||||
|
||||
// Verify that no workers are registered since we didn't initialize them
|
||||
let stats = app_context.worker_registry.stats();
|
||||
assert_eq!(
|
||||
stats.total_workers, 0,
|
||||
"No workers should be registered without initialization"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user