mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-11 08:38:24 +00:00
test(proxy): read the counter directly in the another-proxy lost-counter test
The refusal there can come from budget reservation, whose message carries the request's own reservation, so the test now checks the counter in Redis.
This commit is contained in:
parent
5a031c45b5
commit
5264872c20
1 changed files with 9 additions and 1 deletions
|
|
@ -768,7 +768,15 @@ def test_a_lost_counter_keeps_spend_another_proxy_has_not_written_yet(gateway: G
|
|||
_lose_counter(cache, end_user)
|
||||
second: Final = _chat(peer, model, key, end_user)
|
||||
assert second.status_code == 200, second.text
|
||||
expected_spend: Final = _COLD_SEED_SPEND + 2 * call_cost
|
||||
counted: Final = eventually(
|
||||
lambda: _counter(cache, end_user),
|
||||
lambda value: value is not None and value == pytest.approx(expected_spend),
|
||||
seconds=30,
|
||||
return_last_on_timeout=True,
|
||||
)
|
||||
|
||||
denied: Final = _chat(gateway, model, key, end_user)
|
||||
|
||||
assert _refused_spend(denied, end_user) == pytest.approx(_COLD_SEED_SPEND + 2 * call_cost)
|
||||
assert counted == pytest.approx(expected_spend)
|
||||
assert _denial_error(denied)["type"] == "budget_exceeded", denied.text
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue