mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-04 00:17:45 +08:00
第一批减负(对应 docs/operations/gateway-ci-timeout-reduction-plan.md): A1 架构守卫迁出 - 将 src/tests/architecture/**(208 项 / 约 1.5 万行字符串断言)迁至 tests/architecture/,入口 tests/architecture_guard.rs - 从 lib cfg(test) 巨型编译单元移除,压低 rustc 峰值与 OOM 风险 - 断言逻辑不变;helper 可见性改为 pub(crate) A2 构建指纹统一 - test_gateway 的 mold RUSTFLAGS / RUST_MIN_STACK / sccache 上移至 job 级 env - rust-ci.yml 全部 toolchain 钉住 1.95.0(与 rust-toolchain.toml、fmt/clippy 一致) - Gateway 独立 cache key,避免 mold 指纹与无 mold job 互相污染 A4 补安全集成测试 - 新增 Test integration targets:cargo nextest run -p aether-gateway --tests - 覆盖 architecture_guard + 此前未执行的 admin_unsigned_identity_headers 验证:architecture_guard + admin_unsigned 209 passed; cargo check -p aether-gateway --lib --tests 通过;cargo fmt --check 通过。 不创建 PR,仅本地分支提交。
149 lines
5.0 KiB
Rust
149 lines
5.0 KiB
Rust
use super::*;
|
|
|
|
#[test]
|
|
fn admin_billing_wallets_boundaries_are_split() {
|
|
let wallets_mod =
|
|
read_workspace_file("apps/aether-gateway/src/handlers/admin/billing/wallets/mod.rs");
|
|
for pattern in ["mod mutations;", "mod reads;", "mod routes;", "mod shared;"] {
|
|
assert!(
|
|
wallets_mod.contains(pattern),
|
|
"handlers/admin/billing/wallets/mod.rs should register {pattern}"
|
|
);
|
|
}
|
|
|
|
let shared_mod =
|
|
read_workspace_file("apps/aether-gateway/src/handlers/admin/billing/wallets/shared/mod.rs");
|
|
for pattern in [
|
|
"mod normalizers;",
|
|
"mod payloads;",
|
|
"mod requests;",
|
|
"mod responses;",
|
|
"mod support;",
|
|
] {
|
|
assert!(
|
|
shared_mod.contains(pattern),
|
|
"handlers/admin/billing/wallets/shared/mod.rs should register {pattern}"
|
|
);
|
|
}
|
|
|
|
let mutations_mod = read_workspace_file(
|
|
"apps/aether-gateway/src/handlers/admin/billing/wallets/mutations/mod.rs",
|
|
);
|
|
for pattern in [
|
|
"mod adjust;",
|
|
"mod complete_refund;",
|
|
"mod fail_refund;",
|
|
"mod process_refund;",
|
|
"mod recharge;",
|
|
] {
|
|
assert!(
|
|
mutations_mod.contains(pattern),
|
|
"handlers/admin/billing/wallets/mutations/mod.rs should register {pattern}"
|
|
);
|
|
}
|
|
|
|
let reads_mod =
|
|
read_workspace_file("apps/aether-gateway/src/handlers/admin/billing/wallets/reads/mod.rs");
|
|
for pattern in [
|
|
"mod detail;",
|
|
"mod ledger;",
|
|
"mod list;",
|
|
"mod refund_requests;",
|
|
"mod refunds;",
|
|
"mod transactions;",
|
|
] {
|
|
assert!(
|
|
reads_mod.contains(pattern),
|
|
"handlers/admin/billing/wallets/reads/mod.rs should register {pattern}"
|
|
);
|
|
}
|
|
|
|
for path in [
|
|
"apps/aether-gateway/src/handlers/admin/billing/wallets/shared/core.rs",
|
|
"apps/aether-gateway/src/handlers/admin/billing/wallets/mutations/core.rs",
|
|
"apps/aether-gateway/src/handlers/admin/billing/wallets/reads.rs",
|
|
] {
|
|
assert!(
|
|
!workspace_file_exists(path),
|
|
"{path} should be removed after wallets boundaries are split"
|
|
);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn admin_billing_collectors_owner_is_split() {
|
|
let collectors_mod =
|
|
read_workspace_file("apps/aether-gateway/src/handlers/admin/billing/collectors/mod.rs");
|
|
for pattern in ["mod reads;", "mod support;", "mod writes;"] {
|
|
assert!(
|
|
collectors_mod.contains(pattern),
|
|
"handlers/admin/billing/collectors/mod.rs should register {pattern}"
|
|
);
|
|
}
|
|
|
|
for path in [
|
|
"apps/aether-gateway/src/handlers/admin/billing/collectors/support.rs",
|
|
"apps/aether-gateway/src/handlers/admin/billing/collectors/reads.rs",
|
|
"apps/aether-gateway/src/handlers/admin/billing/collectors/writes.rs",
|
|
] {
|
|
assert!(
|
|
workspace_file_exists(path),
|
|
"{path} should exist after collectors owner split"
|
|
);
|
|
}
|
|
|
|
assert!(
|
|
!workspace_file_exists("apps/aether-gateway/src/handlers/admin/billing/collectors.rs"),
|
|
"handlers/admin/billing/collectors.rs should be removed after collectors owner split"
|
|
);
|
|
|
|
let collectors_support =
|
|
read_workspace_file("apps/aether-gateway/src/handlers/admin/billing/collectors/support.rs");
|
|
assert!(
|
|
!collectors_support.contains("pub(super) use super::super::{"),
|
|
"handlers/admin/billing/collectors/support.rs should not keep wildcard bridge re-export from billing root"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn admin_billing_presets_owner_is_split() {
|
|
let presets_mod =
|
|
read_workspace_file("apps/aether-gateway/src/handlers/admin/billing/presets/mod.rs");
|
|
for pattern in ["mod apply;", "mod support;"] {
|
|
assert!(
|
|
presets_mod.contains(pattern),
|
|
"handlers/admin/billing/presets/mod.rs should register {pattern}"
|
|
);
|
|
}
|
|
|
|
for path in [
|
|
"apps/aether-gateway/src/handlers/admin/billing/presets/support.rs",
|
|
"apps/aether-gateway/src/handlers/admin/billing/presets/apply.rs",
|
|
] {
|
|
assert!(
|
|
workspace_file_exists(path),
|
|
"{path} should exist after presets owner split"
|
|
);
|
|
}
|
|
|
|
assert!(
|
|
!workspace_file_exists("apps/aether-gateway/src/handlers/admin/billing/presets.rs"),
|
|
"handlers/admin/billing/presets.rs should be removed after presets owner split"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn admin_billing_wallets_support_uses_wrapped_request_context() {
|
|
let wallets_support = read_workspace_file(
|
|
"apps/aether-gateway/src/handlers/admin/billing/wallets/shared/support.rs",
|
|
);
|
|
assert!(
|
|
wallets_support.contains("use crate::handlers::admin::request::AdminRequestContext;"),
|
|
"handlers/admin/billing/wallets/shared/support.rs should consume wrapped AdminRequestContext"
|
|
);
|
|
assert!(
|
|
!wallets_support.contains("GatewayPublicRequestContext"),
|
|
"handlers/admin/billing/wallets/shared/support.rs should not keep raw GatewayPublicRequestContext seam"
|
|
);
|
|
}
|