Repository navigation
test(integration): wait for the team member Redis counter to settle between budget calls - #47599
mateo-berri wants to merge 1 commit into
Conversation
…etween budget calls
|
@litereview guide |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
📝 guideScope: full · Full PR review. On main, the integration-accounting job sometimes goes red. A team member's next call answers Walkthrough
What changes for the caller: nothing. No proxy code changes. The test now waits for the member's Redis counter in the flaky test and in the two sibling tests that send a second request on the same member. Tests added: no new tests. Three existing integration tests in Black box coverage: Not needed. One thing to decide: a back-to-back call on a tight member budget is refused for a few seconds after a 200 (4 of 4 locally). The new waits step around this, and no test pins it down. If it counts as a product bug, Checks and execution details
View review · Reviewed |
|
Closing since the CI reds came from the double charge #47510 fixed, and the unchanged test now passes 3 of 3 on main |
Closed without merging. The integration-accounting reds this PR targeted came from the double charge that #47510 fixed, where one 0.06 chat billed 0.12. With that charge gone, the unchanged test passes on main, so the extra Redis waits here change nothing
The window the demo below shows is still real, since a request sent right after a 200 chat can get a 422 until the reservation is released. It is tracked separately and not fixed here
/stupid
Original
TLDR
Problem this solves:
How it solves it:
User Flow
Before: a contributor watching main CI sees integration-accounting go red on a test nobody touched
Budget has been exceeded! TeamMember=<user>:<team> Current cost: 1.000000000000003, Max budget: 1.0, so the job goes redAfter: the same job passes on every run
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or moreDelays 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
QA finding: before and after both pass, so this PR does not fix anything on main. Both legs ran through the integration harness's accounting lane (
python tests/integration/run.py accounting <file>, 2 xdist workers, each with its own gateway and peer gateway sharing one Postgres and one Redis) against the harness's priced fake upstream, so no provider $$$ applies. Logs and the demo rows are in this gistBefore (2c6b280)
tests/integration/spend/test_team_member_spend.pyon the accounting lane three timesAfter (4097bf2)
tests/integration/spend/test_team_member_spend.pyon the accounting lane three timesType
✅ Test
Caveats (if any)
High
Final Attestation