Files
ProxyPilot/internal/runtime/executor/quota_fallback_test.go
RCD 0af0ad14e5 Merge upstream CLIProxyAPI v6.8.28–v6.8.32
Upstream changes:
- Codex responses compaction payload compatibility
- Codex usage_limit_reached retry-after, deterministic parsing
- Codex refresh_token_reused non-retryable fix
- Qwen rate limiting and quota error handling
- Context management compatibility simplification
- Antigravity tool_result image fix, model list backfill, deep copy cache
- Auth auto-refresh interval/concurrency limiting
- Auth hook OnResult refactor (replaces MarkResult)
- Gemini-3.1-flash-image support
- Registry cleanup of outdated model definitions

Fork resolution:
- Accept upstream's consolidated conductor.go (auto-refresh, round-tripper)
- Delete stale conductor_oauth.go, conductor_token.go (upstream reversed split)
- Delete stale provider_rotation_test.go (references removed method)
2026-02-27 20:58:16 +07:00

42 lines
1.3 KiB
Go

package executor
import "testing"
func TestParseProjectIDCandidates(t *testing.T) {
tests := []struct {
name string
in string
want []string
}{
{name: "empty", in: "", want: nil},
{name: "single", in: "proj-a", want: []string{"proj-a"}},
{name: "trim", in: " proj-a ", want: []string{"proj-a"}},
{name: "list", in: "a,b,c", want: []string{"a", "b", "c"}},
{name: "list_trim", in: " a, b ,c ", want: []string{"a", "b", "c"}},
{name: "dedupe_case_insensitive", in: "a,A,a", want: []string{"a"}},
{name: "skip_empty_entries", in: "a,,b, ,c", want: []string{"a", "b", "c"}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := parseProjectIDCandidates(tt.in)
if len(got) != len(tt.want) {
t.Fatalf("len=%d, want %d (got=%v)", len(got), len(tt.want), got)
}
for i := range got {
if got[i] != tt.want[i] {
t.Fatalf("idx %d: got %q want %q (got=%v)", i, got[i], tt.want[i], got)
}
}
})
}
}
func TestQuotaPreviewFallbackOrder(t *testing.T) {
if got := quotaPreviewFallbackOrder("gemini-3-flash"); len(got) != 1 || got[0] != "gemini-3-pro-preview" {
t.Fatalf("unexpected fallback for gemini-3-flash: %v", got)
}
if got := quotaPreviewFallbackOrder("gemini-3-pro-preview"); got != nil {
t.Fatalf("expected nil fallback for gemini-3-pro-preview, got %v", got)
}
}