mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 02:17:46 +08:00
@@ -800,7 +800,7 @@ async fn gateway_handles_admin_health_status_locally_with_trusted_admin_principa
|
||||
.as_array()
|
||||
.expect("timeline should be an array")
|
||||
.len(),
|
||||
100
|
||||
60
|
||||
);
|
||||
assert!(formats[0]["time_range_start"].is_string());
|
||||
assert!(formats[0]["time_range_end"].is_string());
|
||||
|
||||
@@ -1287,7 +1287,7 @@ async fn gateway_handles_public_health_api_formats_without_proxying_upstream() {
|
||||
assert_eq!(formats[0]["total_attempts"], 1);
|
||||
assert_eq!(formats[0]["success_rate"], 1.0);
|
||||
assert_eq!(formats[0]["events"].as_array().map(Vec::len), Some(1));
|
||||
assert_eq!(formats[0]["timeline"].as_array().map(Vec::len), Some(100));
|
||||
assert_eq!(formats[0]["timeline"].as_array().map(Vec::len), Some(60));
|
||||
assert_eq!(formats[1]["api_format"], "openai:chat");
|
||||
assert_eq!(formats[1]["api_path"], "/v1/chat/completions");
|
||||
assert_eq!(formats[1]["total_attempts"], 3);
|
||||
@@ -1296,7 +1296,7 @@ async fn gateway_handles_public_health_api_formats_without_proxying_upstream() {
|
||||
assert_eq!(formats[1]["skipped_count"], 1);
|
||||
assert_eq!(formats[1]["success_rate"], 0.5);
|
||||
assert_eq!(formats[1]["events"].as_array().map(Vec::len), Some(3));
|
||||
assert_eq!(formats[1]["timeline"].as_array().map(Vec::len), Some(100));
|
||||
assert_eq!(formats[1]["timeline"].as_array().map(Vec::len), Some(60));
|
||||
assert_eq!(*upstream_hits.lock().expect("mutex should lock"), 0);
|
||||
|
||||
gateway_handle.abort();
|
||||
@@ -5389,12 +5389,12 @@ async fn gateway_handles_users_me_endpoint_status_locally_without_proxying_upstr
|
||||
assert_eq!(items[0]["api_format"], "claude:messages");
|
||||
assert_eq!(items[0]["display_name"], "Claude Messages");
|
||||
assert_eq!(items[0]["health_score"], 1.0);
|
||||
assert_eq!(items[0]["timeline"].as_array().map(Vec::len), Some(100));
|
||||
assert_eq!(items[0]["timeline"].as_array().map(Vec::len), Some(60));
|
||||
assert!(items[0].get("total_endpoints").is_none());
|
||||
assert_eq!(items[1]["api_format"], "openai:chat");
|
||||
assert_eq!(items[1]["display_name"], "OpenAI Chat");
|
||||
assert_eq!(items[1]["health_score"], 0.5);
|
||||
assert_eq!(items[1]["timeline"].as_array().map(Vec::len), Some(100));
|
||||
assert_eq!(items[1]["timeline"].as_array().map(Vec::len), Some(60));
|
||||
assert!(items[1].get("total_keys").is_none());
|
||||
assert_eq!(*upstream_hits.lock().expect("mutex should lock"), 0);
|
||||
|
||||
|
||||
@@ -649,11 +649,24 @@ async fn gateway_handles_admin_dashboard_stats_locally_without_proxying_upstream
|
||||
assert_eq!(payload["today"]["tokens"], 17_450);
|
||||
assert_eq!(payload["today"]["cost"], json!(2.5));
|
||||
assert_eq!(payload["cost_stats"]["cost_savings"], json!(0.025));
|
||||
assert_eq!(payload["stats"][2]["subValue"], json!("节省 $0.01"));
|
||||
assert_eq!(payload["stats"][0]["value"], json!("2"));
|
||||
assert_eq!(payload["stats"][1]["value"], json!("17.4K"));
|
||||
let stats = payload["stats"].as_array().expect("stats should be array");
|
||||
assert_eq!(stats.len(), 4);
|
||||
let today_request_stats = stats
|
||||
.iter()
|
||||
.find(|item| item["name"] == json!("今日请求 / 费用"))
|
||||
.expect("today request stats card should exist");
|
||||
assert_eq!(today_request_stats["value"], json!("2 / $2.50"));
|
||||
assert_eq!(
|
||||
payload["stats"][1]["subValue"],
|
||||
today_request_stats["subValue"],
|
||||
json!("成功率 100.0% / 节省 $0.01")
|
||||
);
|
||||
let today_token_stats = stats
|
||||
.iter()
|
||||
.find(|item| item["name"] == json!("今日 Token"))
|
||||
.expect("today token stats card should exist");
|
||||
assert_eq!(today_token_stats["value"], json!("17.4K"));
|
||||
assert_eq!(
|
||||
today_token_stats["subValue"],
|
||||
json!("输入 12.1K / 输出 3.1K · 写缓存 1.25K / 读缓存 1K")
|
||||
);
|
||||
assert_eq!(payload["users"]["total"], 2);
|
||||
|
||||
Reference in New Issue
Block a user