test(acceptance): 验证厂商三类额度与优先路由

为 provider-burst 固定三平台并发、RPM、TPM 和优先级组合,使用稳定 token 用量的本地视频负载验证同级按容量分流及低优先级溢出。\n\n报告升级为 v2,强制校验三类额度峰值精确命中上限、不越界、队列回收、三 Worker 分发以及重复提交和回调安全。\n\n验证:\n- env -u AI_GATEWAY_TEST_DATABASE_URL go test ./... -count=1\n- go vet ./...\n- bash -n scripts/acceptance/provider-burst.sh scripts/acceptance/run-local-acceptance.sh\n- shellcheck -x scripts/acceptance/provider-burst.sh scripts/acceptance/run-local-acceptance.sh
This commit is contained in:
2026-08-03 11:48:54 +08:00
parent aa4f8532bb
commit 8485f14bc4
5 changed files with 129 additions and 32 deletions
+12
View File
@@ -134,3 +134,15 @@ func TestReservationsFromPolicySkipsNonPositiveLimits(t *testing.T) {
t.Fatalf("expected concurrent reservation with limit 2, got %+v", reservations[0])
}
}
func TestProviderQuotaPromptReservesSevenTokens(t *testing.T) {
body := map[string]any{
"content": []any{map[string]any{
"type": "text",
"text": "acceptance-provider-quota",
}},
}
if got := estimateRequestTokens(body); got != 7 {
t.Fatalf("provider quota prompt tokens=%d, want 7", got)
}
}