mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-01 17:00:21 +08:00
fix(admin): 同步 key 自动获取模型与相关测试
Closes #292 Co-authored-by: AAEE86 <ppk0227@hotmail.com>
This commit is contained in:
@@ -508,30 +508,12 @@ async fn gateway_records_failed_usage_when_all_local_openai_chat_candidates_exha
|
||||
let body_json: serde_json::Value = response.json().await.expect("body should parse");
|
||||
assert_eq!(body_json["error"]["type"], "http_error");
|
||||
|
||||
<<<<<<< HEAD
|
||||
let mut stored_usage = None;
|
||||
for _ in 0..50 {
|
||||
stored_usage = usage_repository
|
||||
.find_by_request_id("trace-openai-chat-local-report-sync-failure-123")
|
||||
.await
|
||||
.expect("usage lookup should succeed");
|
||||
if stored_usage
|
||||
.as_ref()
|
||||
.is_some_and(|usage| usage.status == "failed")
|
||||
{
|
||||
break;
|
||||
}
|
||||
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
|
||||
}
|
||||
let stored_usage = stored_usage.expect("failed usage should be recorded");
|
||||
=======
|
||||
let stored_usage = wait_for_usage_status(
|
||||
usage_repository.as_ref(),
|
||||
"trace-openai-chat-local-report-sync-failure-123",
|
||||
"failed",
|
||||
)
|
||||
.await;
|
||||
>>>>>>> test(gateway): 稳定本地 usage 终态断言
|
||||
assert_eq!(stored_usage.status, "failed");
|
||||
assert_eq!(stored_usage.billing_status, "void");
|
||||
assert_eq!(stored_usage.status_code, Some(503));
|
||||
@@ -735,30 +717,12 @@ async fn gateway_records_failed_usage_for_claude_runtime_miss_without_execution_
|
||||
"没有可用的提供商支持模型 claude-sonnet-4-5 的同步请求"
|
||||
);
|
||||
|
||||
<<<<<<< HEAD
|
||||
let mut stored_usage = None;
|
||||
for _ in 0..50 {
|
||||
stored_usage = usage_repository
|
||||
.find_by_request_id("trace-claude-runtime-miss-usage-123")
|
||||
.await
|
||||
.expect("usage lookup should succeed");
|
||||
if stored_usage
|
||||
.as_ref()
|
||||
.is_some_and(|usage| usage.status == "failed")
|
||||
{
|
||||
break;
|
||||
}
|
||||
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
|
||||
}
|
||||
let stored_usage = stored_usage.expect("failed usage should be recorded");
|
||||
=======
|
||||
let stored_usage = wait_for_usage_status(
|
||||
usage_repository.as_ref(),
|
||||
"trace-claude-runtime-miss-usage-123",
|
||||
"failed",
|
||||
)
|
||||
.await;
|
||||
>>>>>>> test(gateway): 稳定本地 usage 终态断言
|
||||
assert_eq!(stored_usage.status, "failed");
|
||||
assert_eq!(stored_usage.billing_status, "void");
|
||||
assert_eq!(stored_usage.status_code, Some(503));
|
||||
@@ -951,30 +915,12 @@ async fn gateway_handles_local_openai_chat_stream_report_with_local_reporting_wh
|
||||
"data: {\"id\":\"chatcmpl-local-report-stream-123\",\"usage\":{\"input_tokens\":2,\"output_tokens\":4,\"total_tokens\":6}}\n\ndata: [DONE]\n\n"
|
||||
);
|
||||
|
||||
<<<<<<< HEAD
|
||||
let mut stored_usage = None;
|
||||
for _ in 0..50 {
|
||||
stored_usage = usage_repository
|
||||
.find_by_request_id("trace-openai-chat-local-report-stream-123")
|
||||
.await
|
||||
.expect("usage lookup should succeed");
|
||||
if stored_usage
|
||||
.as_ref()
|
||||
.is_some_and(|usage| usage.status == "completed")
|
||||
{
|
||||
break;
|
||||
}
|
||||
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
|
||||
}
|
||||
let stored_usage = stored_usage.expect("usage should be recorded");
|
||||
=======
|
||||
let stored_usage = wait_for_usage_status(
|
||||
usage_repository.as_ref(),
|
||||
"trace-openai-chat-local-report-stream-123",
|
||||
"completed",
|
||||
)
|
||||
.await;
|
||||
>>>>>>> test(gateway): 稳定本地 usage 终态断言
|
||||
assert_eq!(stored_usage.status, "completed");
|
||||
assert_eq!(stored_usage.total_tokens, 6);
|
||||
assert_eq!(stored_usage.first_byte_time_ms, Some(11));
|
||||
@@ -1220,30 +1166,12 @@ async fn gateway_records_failed_usage_when_all_local_claude_cli_candidates_are_s
|
||||
"没有可用的提供商支持模型 gpt-5.4 的同步请求"
|
||||
);
|
||||
|
||||
<<<<<<< HEAD
|
||||
let mut stored_usage = None;
|
||||
for _ in 0..50 {
|
||||
stored_usage = usage_repository
|
||||
.find_by_request_id("trace-claude-cli-usage-local-miss-123")
|
||||
.await
|
||||
.expect("usage lookup should succeed");
|
||||
if stored_usage
|
||||
.as_ref()
|
||||
.is_some_and(|usage| usage.status == "failed")
|
||||
{
|
||||
break;
|
||||
}
|
||||
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
|
||||
}
|
||||
let stored_usage = stored_usage.expect("failed usage should be recorded");
|
||||
=======
|
||||
let stored_usage = wait_for_usage_status(
|
||||
usage_repository.as_ref(),
|
||||
"trace-claude-cli-usage-local-miss-123",
|
||||
"failed",
|
||||
)
|
||||
.await;
|
||||
>>>>>>> test(gateway): 稳定本地 usage 终态断言
|
||||
assert_eq!(stored_usage.status, "failed");
|
||||
assert_eq!(stored_usage.billing_status, "void");
|
||||
assert_eq!(stored_usage.status_code, Some(503));
|
||||
@@ -1521,30 +1449,12 @@ async fn gateway_keeps_failed_usage_request_capture_lightweight_for_large_local_
|
||||
Some("all_candidates_skipped")
|
||||
);
|
||||
|
||||
<<<<<<< HEAD
|
||||
let mut stored_usage = None;
|
||||
for _ in 0..50 {
|
||||
stored_usage = usage_repository
|
||||
.find_by_request_id("trace-claude-cli-usage-local-miss-large-123")
|
||||
.await
|
||||
.expect("usage lookup should succeed");
|
||||
if stored_usage
|
||||
.as_ref()
|
||||
.is_some_and(|usage| usage.status == "failed")
|
||||
{
|
||||
break;
|
||||
}
|
||||
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
|
||||
}
|
||||
let stored_usage = stored_usage.expect("failed usage should be recorded");
|
||||
=======
|
||||
let stored_usage = wait_for_usage_status(
|
||||
usage_repository.as_ref(),
|
||||
"trace-claude-cli-usage-local-miss-large-123",
|
||||
"failed",
|
||||
)
|
||||
.await;
|
||||
>>>>>>> test(gateway): 稳定本地 usage 终态断言
|
||||
assert_eq!(stored_usage.status, "failed");
|
||||
assert!(stored_usage.request_body.is_none());
|
||||
assert_eq!(
|
||||
|
||||
Reference in New Issue
Block a user