[router] Add rustfmt and set group imports by default (#11732)

This commit is contained in:
Chang Su
2025-10-16 17:33:29 -07:00
committed by GitHub
parent 7a7f99beb7
commit dc01313da1
126 changed files with 1127 additions and 813 deletions

View File

@@ -148,8 +148,7 @@ mod tests {
async fn test_mock_server_with_rmcp_client() {
let mut server = MockMCPServer::start().await.unwrap();
use rmcp::transport::StreamableHttpClientTransport;
use rmcp::ServiceExt;
use rmcp::{transport::StreamableHttpClientTransport, ServiceExt};
let transport = StreamableHttpClientTransport::from_uri(server.url().as_str());
let client = ().serve(transport).await;

View File

@@ -2,19 +2,21 @@
#![allow(dead_code)]
use std::{net::SocketAddr, sync::Arc};
use axum::{
body::Body,
extract::{Request, State},
http::{HeaderValue, StatusCode},
response::sse::{Event, KeepAlive},
response::{IntoResponse, Response, Sse},
response::{
sse::{Event, KeepAlive},
IntoResponse, Response, Sse,
},
routing::post,
Json, Router,
};
use futures_util::stream::{self, StreamExt};
use serde_json::json;
use std::net::SocketAddr;
use std::sync::Arc;
use tokio::net::TcpListener;
/// Mock OpenAI API server for testing

View File

@@ -1,20 +1,25 @@
// Mock worker for testing - these functions are used by integration tests
#![allow(dead_code)]
use std::{
collections::{HashMap, HashSet},
convert::Infallible,
sync::{Arc, Mutex, OnceLock},
time::{SystemTime, UNIX_EPOCH},
};
use axum::{
extract::{Json, Path, State},
http::StatusCode,
response::sse::{Event, KeepAlive},
response::{IntoResponse, Response, Sse},
response::{
sse::{Event, KeepAlive},
IntoResponse, Response, Sse,
},
routing::{get, post},
Router,
};
use futures_util::stream::{self, StreamExt};
use serde_json::json;
use std::collections::{HashMap, HashSet};
use std::convert::Infallible;
use std::sync::{Arc, Mutex, OnceLock};
use std::time::{SystemTime, UNIX_EPOCH};
use tokio::sync::RwLock;
use uuid::Uuid;

View File

@@ -7,19 +7,24 @@ pub mod mock_worker;
pub mod streaming_helpers;
pub mod test_app;
use serde_json::json;
use sglang_router_rs::config::RouterConfig;
use sglang_router_rs::core::{LoadMonitor, WorkerRegistry};
use sglang_router_rs::data_connector::{
MemoryConversationItemStorage, MemoryConversationStorage, MemoryResponseStorage,
use std::{
fs,
path::PathBuf,
sync::{Arc, Mutex, OnceLock},
};
use serde_json::json;
use sglang_router_rs::{
config::RouterConfig,
core::{LoadMonitor, WorkerRegistry},
data_connector::{
MemoryConversationItemStorage, MemoryConversationStorage, MemoryResponseStorage,
},
middleware::TokenBucket,
policies::PolicyRegistry,
protocols::common::{Function, Tool},
server::AppContext,
};
use sglang_router_rs::middleware::TokenBucket;
use sglang_router_rs::policies::PolicyRegistry;
use sglang_router_rs::protocols::common::{Function, Tool};
use sglang_router_rs::server::AppContext;
use std::fs;
use std::path::PathBuf;
use std::sync::{Arc, Mutex, OnceLock};
/// Helper function to create AppContext for tests
pub fn create_test_context(config: RouterConfig) -> Arc<AppContext> {

View File

@@ -1,3 +1,5 @@
use std::sync::{Arc, OnceLock};
use axum::Router;
use reqwest::Client;
use sglang_router_rs::{
@@ -11,7 +13,6 @@ use sglang_router_rs::{
routers::RouterTrait,
server::{build_app, AppContext, AppState},
};
use std::sync::{Arc, OnceLock};
/// Create a test Axum application using the actual server's build_app function
#[allow(dead_code)]