[router] remove old/oudated/useless comments across code base (#10968)
This commit is contained in:
@@ -576,7 +576,6 @@ mod model_info_tests {
|
||||
let ctx = TestContext::new(vec![]).await;
|
||||
let app = ctx.create_app().await;
|
||||
|
||||
// Test server info with no workers
|
||||
let req = Request::builder()
|
||||
.method("GET")
|
||||
.uri("/get_server_info")
|
||||
@@ -593,7 +592,6 @@ mod model_info_tests {
|
||||
resp.status()
|
||||
);
|
||||
|
||||
// Test model info with no workers
|
||||
let req = Request::builder()
|
||||
.method("GET")
|
||||
.uri("/get_model_info")
|
||||
@@ -610,7 +608,6 @@ mod model_info_tests {
|
||||
resp.status()
|
||||
);
|
||||
|
||||
// Test v1/models with no workers
|
||||
let req = Request::builder()
|
||||
.method("GET")
|
||||
.uri("/v1/models")
|
||||
@@ -652,7 +649,6 @@ mod model_info_tests {
|
||||
|
||||
let app = ctx.create_app().await;
|
||||
|
||||
// Test that model info is consistent across workers
|
||||
for _ in 0..5 {
|
||||
let req = Request::builder()
|
||||
.method("GET")
|
||||
@@ -795,7 +791,6 @@ mod worker_management_tests {
|
||||
let resp = app.clone().oneshot(req).await.unwrap();
|
||||
assert_eq!(resp.status(), StatusCode::OK);
|
||||
|
||||
// Verify it's removed
|
||||
let req = Request::builder()
|
||||
.method("GET")
|
||||
.uri("/list_workers")
|
||||
@@ -1302,7 +1297,6 @@ mod error_tests {
|
||||
|
||||
let app = ctx.create_app().await;
|
||||
|
||||
// Test unknown endpoint
|
||||
let req = Request::builder()
|
||||
.method("GET")
|
||||
.uri("/unknown_endpoint")
|
||||
@@ -1312,7 +1306,6 @@ mod error_tests {
|
||||
let resp = app.clone().oneshot(req).await.unwrap();
|
||||
assert_eq!(resp.status(), StatusCode::NOT_FOUND);
|
||||
|
||||
// Test POST to unknown endpoint
|
||||
let req = Request::builder()
|
||||
.method("POST")
|
||||
.uri("/api/v2/generate")
|
||||
@@ -1606,7 +1599,6 @@ mod cache_tests {
|
||||
.unwrap();
|
||||
let body_json: serde_json::Value = serde_json::from_slice(&body).unwrap();
|
||||
|
||||
// Verify the response contains load information
|
||||
assert!(body_json.is_object());
|
||||
// The exact structure depends on the implementation
|
||||
// but should contain worker load information
|
||||
@@ -1797,7 +1789,6 @@ mod request_id_tests {
|
||||
|
||||
let app = ctx.create_app().await;
|
||||
|
||||
// Test 1: Request without any request ID header should generate one
|
||||
let payload = json!({
|
||||
"text": "Test request",
|
||||
"stream": false
|
||||
@@ -1830,7 +1821,6 @@ mod request_id_tests {
|
||||
"Request ID should have content after prefix"
|
||||
);
|
||||
|
||||
// Test 2: Request with custom x-request-id should preserve it
|
||||
let custom_id = "custom-request-id-123";
|
||||
let req = Request::builder()
|
||||
.method("POST")
|
||||
@@ -1847,7 +1837,6 @@ mod request_id_tests {
|
||||
assert!(response_id.is_some());
|
||||
assert_eq!(response_id.unwrap(), custom_id);
|
||||
|
||||
// Test 3: Different endpoints should have different prefixes
|
||||
let chat_payload = json!({
|
||||
"messages": [{"role": "user", "content": "Hello"}],
|
||||
"model": "test-model"
|
||||
@@ -1871,7 +1860,6 @@ mod request_id_tests {
|
||||
.unwrap()
|
||||
.starts_with("chatcmpl-"));
|
||||
|
||||
// Test 4: Alternative request ID headers should be recognized
|
||||
let req = Request::builder()
|
||||
.method("POST")
|
||||
.uri("/generate")
|
||||
@@ -1948,7 +1936,6 @@ mod request_id_tests {
|
||||
"stream": false
|
||||
});
|
||||
|
||||
// Test custom header is recognized
|
||||
let req = Request::builder()
|
||||
.method("POST")
|
||||
.uri("/generate")
|
||||
@@ -2013,7 +2000,6 @@ mod rerank_tests {
|
||||
.unwrap();
|
||||
let body_json: serde_json::Value = serde_json::from_slice(&body).unwrap();
|
||||
|
||||
// Verify response structure
|
||||
assert!(body_json.get("results").is_some());
|
||||
assert!(body_json.get("model").is_some());
|
||||
assert_eq!(body_json["model"], "test-rerank-model");
|
||||
@@ -2021,7 +2007,6 @@ mod rerank_tests {
|
||||
let results = body_json["results"].as_array().unwrap();
|
||||
assert_eq!(results.len(), 2);
|
||||
|
||||
// Verify results are sorted by score (highest first)
|
||||
assert!(results[0]["score"].as_f64().unwrap() >= results[1]["score"].as_f64().unwrap());
|
||||
|
||||
ctx.shutdown().await;
|
||||
@@ -2164,7 +2149,6 @@ mod rerank_tests {
|
||||
|
||||
let app = ctx.create_app().await;
|
||||
|
||||
// Test V1 API format (simplified input)
|
||||
let payload = json!({
|
||||
"query": "machine learning algorithms",
|
||||
"documents": [
|
||||
@@ -2189,7 +2173,6 @@ mod rerank_tests {
|
||||
.unwrap();
|
||||
let body_json: serde_json::Value = serde_json::from_slice(&body).unwrap();
|
||||
|
||||
// Verify response structure
|
||||
assert!(body_json.get("results").is_some());
|
||||
assert!(body_json.get("model").is_some());
|
||||
|
||||
@@ -2199,7 +2182,6 @@ mod rerank_tests {
|
||||
let results = body_json["results"].as_array().unwrap();
|
||||
assert_eq!(results.len(), 3); // All documents should be returned
|
||||
|
||||
// Verify results are sorted by score (highest first)
|
||||
assert!(results[0]["score"].as_f64().unwrap() >= results[1]["score"].as_f64().unwrap());
|
||||
assert!(results[1]["score"].as_f64().unwrap() >= results[2]["score"].as_f64().unwrap());
|
||||
|
||||
@@ -2224,7 +2206,6 @@ mod rerank_tests {
|
||||
|
||||
let app = ctx.create_app().await;
|
||||
|
||||
// Test empty query string (validation should fail)
|
||||
let payload = json!({
|
||||
"query": "",
|
||||
"documents": ["Document 1", "Document 2"],
|
||||
@@ -2241,7 +2222,6 @@ mod rerank_tests {
|
||||
let resp = app.clone().oneshot(req).await.unwrap();
|
||||
assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
|
||||
|
||||
// Test query with only whitespace (validation should fail)
|
||||
let payload = json!({
|
||||
"query": " ",
|
||||
"documents": ["Document 1", "Document 2"],
|
||||
@@ -2258,7 +2238,6 @@ mod rerank_tests {
|
||||
let resp = app.clone().oneshot(req).await.unwrap();
|
||||
assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
|
||||
|
||||
// Test empty documents list (validation should fail)
|
||||
let payload = json!({
|
||||
"query": "test query",
|
||||
"documents": [],
|
||||
@@ -2275,7 +2254,6 @@ mod rerank_tests {
|
||||
let resp = app.clone().oneshot(req).await.unwrap();
|
||||
assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
|
||||
|
||||
// Test invalid top_k (validation should fail)
|
||||
let payload = json!({
|
||||
"query": "test query",
|
||||
"documents": ["Document 1", "Document 2"],
|
||||
|
||||
Reference in New Issue
Block a user