test(streaming): tolerate Vertex 429 wrapped in MidStreamFallbackError (#28669)

Streaming 429s are wrapped in MidStreamFallbackError so the Router can
fall back; the existing 'except litellm.RateLimitError: pass' in
test_vertex_ai_stream no longer matches, causing the generic
pytest.fail branch to fire when upstream Vertex returns 429.

Add a sibling except for MidStreamFallbackError that only swallows it
when e.original_exception is a RateLimitError, so unrelated streaming
failures still fail the test.
This commit is contained in:
yuneng-jiang 2026-05-22 15:57:29 -07:00 committed by GitHub
parent 1b141bc588
commit 574ee7526d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -993,6 +993,11 @@ def test_vertex_ai_stream(provider):
except litellm.RateLimitError as e:
pass
except litellm.exceptions.MidStreamFallbackError as e:
# Streaming 429s are wrapped in MidStreamFallbackError so the
# Router can fall back; treat as a transient rate-limit pass.
if not isinstance(e.original_exception, litellm.RateLimitError):
pytest.fail(f"Error occurred: {e}")
except Exception as e:
pytest.fail(f"Error occurred: {e}")