test(e2e): assert an org budget block is a 429 naming the organization - #33638
Conversation
Greptile SummaryThis PR strengthens the existing
Confidence Score: 5/5Safe to merge — only touches an e2e test file, adds stronger assertions, and leaves all other test cases untouched. The change is a net improvement: it replaces a weaker 'budget blocks eventually' check with explicit assertions on HTTP status and which entity triggered the block. No existing assertion is relaxed, no production code is touched, and the teardown cleanup is preserved correctly with No files require special attention.
|
| Filename | Overview |
|---|---|
| tests/e2e/quota_management/budgets/test_budget_enforcement_e2e.py | Adds a custom run() to OrganizationBudgetCase that asserts HTTP 429 and Organization=<id> in the blocked response body; also promotes org_id from a local variable to self._org_id so run() can reference it. |
Reviews (2): Last reviewed commit: "test(e2e): assert an org budget block is..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
c1ef5a5 to
8f96c00
Compare
|
@greptileai re review |
7015bd2
into
litellm_internal_staging
Relevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Captured at c1ef5a5 (pre-rebase; the branch was later rebased onto the updated base as 8f96c00 and both budget cases re-ran green there) against a live proxy (docker compose stack in tests/e2e) with real paid llama-3.3-70b-versatile calls through the
claude-haiku-4-5model group. Create an org with a tiny max_budget, a team under it with no budget, and a key with only team_id:Drive /v1/chat/completions with that key. Call 1 succeeds and burns through the org cap; call 2 onward is a 429 budget_exceeded that names the organization as the blocker:
All 6 enforcement cases pass against the same live proxy (6 passed in 19.81s) and
basedpyright tests/e2ereports 0 errorsType
✅ Test
Changes
The org budget case in
tests/e2e/quota_management/budgets/test_budget_enforcement_e2e.py(coveringquota_management.budget.organization.blocks_over_limit) already sets up the scenario structurally: the org carries a tinymax_budgetwhile the team under it and the key carry none, so only the org can block. What it never asserted is that the block is attributable to the org from the customer's side.OrganizationBudgetCasenow gets its ownrun()that asserts the refusal is HTTP 429 with error typebudget_exceededAND that the error message names the blocking entity (Organization=<org_id>), so a block that happens to come from some other layer can no longer pass as org-level enforcementStacked on #33632 since it strengthens the same file; the diff here is only the org case
QA runbook
Final Attestation