Files
codex-proxy-rs/backend/crates/gateway-admin/tests/model/client_keys.rs
T
ZyyandCodex 0bfeff28fc refactor(backend): centralize shared models and settings validation
Reuse domain models for observability, account statistics, execution facts,
and group validation. Compose shared settings values while preserving
HTTP and SDK contracts and explicit storage and runtime boundaries.

Verify serialization, concurrency, persistence, and snapshot behavior with
3528 backend tests, strict Clippy, formatting, and architecture checks.

Co-authored-by: Codex <noreply@openai.com>
2026-10-07 02:32:53 +08:00

17 lines
712 B
Rust

//! 验证 Client Key 分组集合的共同上限与唯一性规则
use gateway_admin::model::client_keys::validate_group_ids;
use gateway_core::routing::AccountGroupId;
#[test]
fn client_key_groups_reject_duplicates_and_more_than_one_thousand_ids() {
assert!(validate_group_ids(&[]).is_ok());
let mut groups: Vec<_> = (0..1000)
.map(|index| AccountGroupId::new(format!("grp_{index:032x}")).unwrap())
.collect();
assert!(validate_group_ids(&groups).is_ok());
groups.push(AccountGroupId::new("grp_ffffffffffffffffffffffffffffffff").unwrap());
assert!(validate_group_ids(&groups).is_err());
assert!(validate_group_ids(&[groups[0].clone(), groups[0].clone()]).is_err());
}