fix(test): update provider-matrix tests to expect fallback on quota exhaustion
This commit is contained in:
@@ -18,7 +18,8 @@ describe("runtime-fallback provider matrix quota tests", () => {
|
||||
|
||||
//#then
|
||||
expect(errorType).toBe("quota_exceeded")
|
||||
expect(retryable).toBe(false)
|
||||
// quota exhaustion triggers fallback to next configured model
|
||||
expect(retryable).toBe(true)
|
||||
})
|
||||
|
||||
test("classifies OpenAI billing_hard_limit error as quota_exceeded", () => {
|
||||
@@ -54,7 +55,7 @@ describe("runtime-fallback provider matrix quota tests", () => {
|
||||
})
|
||||
|
||||
describe("Anthropic provider", () => {
|
||||
test("classifies Anthropic quota exceeded as non-retryable", () => {
|
||||
test("classifies Anthropic quota exceeded as retryable to trigger fallback", () => {
|
||||
//#given
|
||||
const error = {
|
||||
name: "QuotaExceededError",
|
||||
@@ -68,10 +69,11 @@ describe("runtime-fallback provider matrix quota tests", () => {
|
||||
|
||||
//#then
|
||||
expect(errorType).toBe("quota_exceeded")
|
||||
expect(retryable).toBe(false)
|
||||
// quota exhaustion triggers fallback to next configured model
|
||||
expect(retryable).toBe(true)
|
||||
})
|
||||
|
||||
test("classifies Anthropic subscription quota as non-retryable", () => {
|
||||
test("classifies Anthropic subscription quota as retryable to trigger fallback", () => {
|
||||
//#given
|
||||
const error = {
|
||||
name: "AI_APICallError",
|
||||
@@ -85,7 +87,8 @@ describe("runtime-fallback provider matrix quota tests", () => {
|
||||
|
||||
//#then
|
||||
expect(errorType).toBe("quota_exceeded")
|
||||
expect(retryable).toBe(false)
|
||||
// quota exhaustion triggers fallback to next configured model
|
||||
expect(retryable).toBe(true)
|
||||
})
|
||||
|
||||
test("classifies Anthropic cooling down with retry signal as retryable (auto-retry pattern)", () => {
|
||||
@@ -139,7 +142,8 @@ describe("runtime-fallback provider matrix quota tests", () => {
|
||||
|
||||
//#then
|
||||
expect(errorType).toBe("quota_exceeded")
|
||||
expect(retryable).toBe(false)
|
||||
// quota exhaustion triggers fallback to next configured model
|
||||
expect(retryable).toBe(true)
|
||||
})
|
||||
|
||||
test("classifies Google rate limit exceeded as retryable", () => {
|
||||
@@ -274,7 +278,7 @@ describe("runtime-fallback provider matrix quota tests", () => {
|
||||
expect(retryable).toBe(true)
|
||||
})
|
||||
|
||||
test("402 payment required is NOT retryable", () => {
|
||||
test("402 payment required triggers fallback via quota_exceeded", () => {
|
||||
//#given
|
||||
const error = { statusCode: 402, message: "Payment Required" }
|
||||
|
||||
@@ -282,7 +286,8 @@ describe("runtime-fallback provider matrix quota tests", () => {
|
||||
const retryable = isRetryableError(error, [429, 500, 502, 503, 504])
|
||||
|
||||
//#then
|
||||
expect(retryable).toBe(false)
|
||||
// payment required is classified as quota_exceeded, which triggers fallback
|
||||
expect(retryable).toBe(true)
|
||||
})
|
||||
|
||||
test("500 server error is retryable", () => {
|
||||
|
||||
Reference in New Issue
Block a user