mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-12-05 00:47:15 +08:00
- Cross-tenant session/LCP affinity across model switches, cascade/parent subagent alias extraction and RESP forwarding, automatic subagent custom_agent requestType promotion, credential-scoped reasoning replay isolation, foreign thoughtSignature scrubbing on *ojson.Doc, 14-key payload order, and 270s prompt-cache keepalive guards. - Shared Google RPC array and HTTP 200 in-band error unwrapping/classification, pre-first-byte same-auth micro-retries for 14 TPU transient errors, expanded quota/billing/policy classification with strict HTTP 403/gRPC 7 TOS validation, and read-only SafetySignals logging. - 32-leg continuationToken stream resumption, dynamic deprecatedModelIds rerouting, Orchestrator model synthesis, ModelDetails capability persistence, authenticated rewriteUri grounding redirects, FULL_ELIGIBILITY_CHECK, ClaimAICodeBankedQuotaReset, and validated no-redirect dynamic endpointUrl onboarding. - PKCE S256 OAuth login, downscoped auth/aicode token minting with bounded cache, mutually verified Home RESP aicode-token handoff, grant/digest refresh continuity verification, flat v1alpha *ojson.Doc codec with GOOGLE_ONE_AI fallback experience, businessaicode parent support, and unbroken FinalizePayloadDoc semantic barrier across v1alpha, v1internal, 403 fallback, continuation, and countTokens. - Full v1alpha control-plane integration (fetchConfig with 8-group proto agySurfaceConfig, typed Mendel flags with conflict rejection, fetchLicenses, prod/preprod consistency, and 2 MiB-guarded KV snapshot publication), auto-mode Mendel routing, real-time v1alpha:fetchQuotaStatus credits refresh with read-only dark-launch shadow comparison and exact int64 comparison, and unified pure-Go Hub 2.35.2 UA + HTTP/1.1-only no-ALPN transport.
42 lines
1.0 KiB
Go
42 lines
1.0 KiB
Go
package helps
|
|
|
|
import "testing"
|
|
|
|
func TestBoundedLRUEvictionAndOperations(t *testing.T) {
|
|
cache := NewBoundedLRU[string, int](2)
|
|
cache.Set("a", 1)
|
|
cache.Set("b", 2)
|
|
if cache.Len() != 2 {
|
|
t.Fatalf("Len() = %d, want 2", cache.Len())
|
|
}
|
|
|
|
// Touch "a" so "b" becomes LRU.
|
|
if v, ok := cache.Get("a"); !ok || v != 1 {
|
|
t.Fatalf("Get(a) = (%d, %v), want (1, true)", v, ok)
|
|
}
|
|
|
|
// Inserting "c" must evict "b" and retain "a" and "c".
|
|
cache.Set("c", 3)
|
|
if cache.Len() != 2 {
|
|
t.Fatalf("Len() after eviction = %d, want 2", cache.Len())
|
|
}
|
|
if _, ok := cache.Get("b"); ok {
|
|
t.Fatal("expected key b to be evicted")
|
|
}
|
|
if v, ok := cache.Get("a"); !ok || v != 1 {
|
|
t.Fatalf("Get(a) = (%d, %v), want (1, true)", v, ok)
|
|
}
|
|
if v, ok := cache.Get("c"); !ok || v != 3 {
|
|
t.Fatalf("Get(c) = (%d, %v), want (3, true)", v, ok)
|
|
}
|
|
|
|
cache.Delete("a")
|
|
if cache.Len() != 1 {
|
|
t.Fatalf("Len() after delete = %d, want 1", cache.Len())
|
|
}
|
|
cache.Purge()
|
|
if cache.Len() != 0 {
|
|
t.Fatalf("Len() after purge = %d, want 0", cache.Len())
|
|
}
|
|
}
|