test(router): set string fallback targets after Router init in the sdk cooldown cases (#48954)

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Kerry Lu 2026-10-28 18:35:54 -07:00 • committed by GitHub
parent 57c1df8c33
commit e4932a4539
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -122,12 +122,12 @@ async def test_cooldown_skips_only_the_failed_duplicate_model_deployment() -> No
@pytest.mark.parametrize(
"router_kwargs",
[{"fallbacks": [{"primary": "backup"}]}, {"default_fallbacks": "backup"}],
ids=["string_fallback_target", "string_default_fallbacks"],
"fallbacks",
[[{"primary": "backup"}], [{"*": "backup"}]],
ids=["string_fallback_target", "string_catch_all_target"],
)
@pytest.mark.asyncio
async def test_string_valued_fallbacks_still_cool_down_the_failing_primary(router_kwargs: dict[str, object]) -> None:
async def test_string_valued_fallbacks_still_cool_down_the_failing_primary(fallbacks: list[dict[str, object]]) -> None:
with wire_server(_peer) as wire:
router: Final = Router(
model_list=[
@ -136,8 +136,8 @@ async def test_string_valued_fallbacks_still_cool_down_the_failing_primary(route
],
allowed_fails=0,
num_retries=0,
**router_kwargs,
)
router.fallbacks = fallbacks
with pytest.raises(litellm.AuthenticationError):
await router.acompletion(
model="primary",