同步完整网关回归的画像与目录契约并说明测试环境

This commit is contained in:
MMEXA
2026-10-01 18:39:17 +08:00
parent 2a63bafd20
commit 65f43a7aef
4 changed files with 18 additions and 14 deletions
@@ -2663,14 +2663,11 @@ mod tests {
assert_eq!(plans.len(), 2);
assert!(plans[0].url.ends_with("/models?client_version=0.145.2"));
assert!(plans[1].url.ends_with("/models?client_version=0.146.0"));
assert_eq!(
plans[0].headers.get("user-agent").map(String::as_str),
Some("codex_cli_rs/0.145.2")
);
assert_eq!(
plans[1].headers.get("user-agent").map(String::as_str),
Some("codex_cli_rs/0.146.0")
);
for (plan, version) in plans.iter().zip(["0.145.2", "0.146.0"]) {
let ua = plan.headers.get("user-agent").expect("画像应包含 UA");
assert!(ua.starts_with(&format!("codex_cli_rs/{version} (")));
assert!(ua.ends_with(") unknown"));
}
let target = target();
assert_ne!(
@@ -849,6 +849,12 @@ async fn gateway_handles_admin_provider_query_models_falls_back_to_codex_preset_
"gpt-5.6-luna",
"gpt-5.6-sol",
"gpt-5.6-terra",
"gpt-6-astra",
"gpt-6-luna",
"gpt-6-sol",
"gpt-6.1-sol",
"gpt-daybreak-blue-latest",
"gpt-daybreak-red-latest",
]
);
assert_eq!(
@@ -1270,10 +1270,9 @@ async fn run_versioned_codex_model_cards_frontdoor_scenario() {
captured_catalog_plan.0,
"https://chatgpt.example/backend-api/codex/models?client_version=0.145.2"
);
assert_eq!(
captured_catalog_plan.1.as_deref(),
Some("codex_cli_rs/0.145.2")
);
let captured_ua = captured_catalog_plan.1.expect("目录请求应包含 UA");
assert!(captured_ua.starts_with("codex_cli_rs/0.145.2 ("));
assert!(captured_ua.ends_with(") unknown"));
let fresh_response = client
.get(format!("{gateway_url}/v1/models?client_version=0.145.2"))
+4 -2
View File
@@ -26,8 +26,10 @@ Apps 文件上传属于 CLI 的 ChatGPT Apps 专用路径,普通自定义 API
```bash
cargo fmt --all -- --check
cargo test --locked -p aether-ai-formats -p aether-oauth -p aether-model-fetch -p aether-provider-transport -p aether-usage-runtime --lib
cargo test --locked -p aether-gateway --lib
RUST_MIN_STACK=16777216 cargo test --locked -p aether-ai-formats -p aether-oauth -p aether-model-fetch -p aether-provider-transport -p aether-usage-runtime --lib -- --test-threads=1
RUST_MIN_STACK=16777216 cargo test --locked -p aether-gateway --lib -- --test-threads=1
```
完整网关测试需要可执行的临时 PostgreSQL 工具(`AETHER_INITDB_BIN`、`AETHER_POSTGRES_BIN`、`AETHER_PG_CTL_BIN`)、权限受控的临时目录,以及不允许组写入的测试运行目录。Unix socket、更新元数据与私有运行文件测试会主动拒绝不安全的路径;测试目录应以 `umask 022` 或更严格的权限创建。
原生记忆端到端测试覆盖真实网关的权限、候选调度、执行计划、模型指令、原生 JSON、成功候选状态与明确停止重试策略下的上游错误响应;执行端使用本地测试服务器,实际账户网络可用性须在部署现场单独验证。