mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-20 08:01:46 +00:00
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>
17 lines
712 B
Rust
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());
|
|
}
|