mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-08 02:17:46 +08:00
refactor(gateway): 重构格式转换候选资格检查并优化测试基础设施
- 将 format_conversion_disabled 的过滤提前到候选遴选阶段,替代原来的 skip_reason 标记机制 - 为测试添加 execution_runtime_sync_override 直接注入支持,避免启动额外 HTTP 服务器 - 将 submit_terminal_event 改为 async record_terminal_event 确保失败用量事件可靠入库 - 新增 test_support 模块封装可重试的 loopback 端口绑定逻辑 - 前端:poolTrace 将 skipped 从隐藏状态移除,新增 buildPoolParticipatedCandidates 统一新旧链路逻辑,并将 skipped 状态色改为 foreground
This commit is contained in:
@@ -30,7 +30,7 @@ pub(super) use super::state::{AppState, FrontdoorCorsConfig};
|
||||
pub(super) use super::usage::UsageRuntimeConfig;
|
||||
|
||||
pub(super) async fn start_server(app: Router) -> (String, tokio::task::JoinHandle<()>) {
|
||||
let listener = tokio::net::TcpListener::bind("127.0.0.1:0")
|
||||
let listener = crate::test_support::bind_loopback_listener()
|
||||
.await
|
||||
.expect("listener should bind");
|
||||
let addr = listener.local_addr().expect("local addr should resolve");
|
||||
@@ -45,6 +45,20 @@ pub(super) async fn start_server(app: Router) -> (String, tokio::task::JoinHandl
|
||||
(format!("http://{addr}"), handle)
|
||||
}
|
||||
|
||||
pub(super) async fn send_request(app: Router, mut request: Request) -> Response {
|
||||
use tower::ServiceExt;
|
||||
|
||||
request
|
||||
.extensions_mut()
|
||||
.insert(axum::extract::ConnectInfo(std::net::SocketAddr::from((
|
||||
[127, 0, 0, 1],
|
||||
40000,
|
||||
))));
|
||||
app.oneshot(request)
|
||||
.await
|
||||
.expect("router request should complete")
|
||||
}
|
||||
|
||||
pub(super) fn build_router_with_execution_runtime_override(
|
||||
execution_runtime_override_base_url: impl Into<String>,
|
||||
) -> Router {
|
||||
|
||||
Reference in New Issue
Block a user