test: use regex-only test string for service-unavailable overload

This commit is contained in:
jiangnan
2026-03-06 04:08:21 +08:00
committed by Altay
parent dda7f3b0bc
commit d0ad9d0534

View File

@@ -540,10 +540,9 @@ describe("classifyFailoverReason", () => {
"This model is currently experiencing high demand. Please try again later.",
),
).toBe("rate_limit");
// "service unavailable" combined with overload indicator → rate_limit
expect(
classifyFailoverReason("service unavailable due to high demand and overloaded servers"),
).toBe("rate_limit");
// "service unavailable" combined with overload/capacity indicator → rate_limit
// (exercises the new regex — none of the standalone patterns match here)
expect(classifyFailoverReason("service unavailable due to capacity limits")).toBe("rate_limit");
expect(
classifyFailoverReason(
'{"error":{"code":503,"message":"The model is overloaded. Please try later","status":"UNAVAILABLE"}}',