litellm/tests/otel_tests
Yuneng Jiang 5c68545104
test: fix stale budget-status and bad-database-url assertions
Two CI checks were asserting behaviour the proxy no longer has. Neither
was catching anything; both now fail for the right reason.

budget_exceeded (tests/otel_tests/test_e2e_budgeting.py)

bf804f5188 made 422 the default for budget refusals and added
budget_exceeded_status_code to restore 429 for callers that need it. The
e2e budget tests still asserted 429, so all six have been failing on a
status change that was deliberate. Assert 422, the documented default,
rather than reading litellm.budget_exceeded_status_code back — a test
that asks the code what it does would have passed straight through this
change and through the next one.

The helpers also caught bare Exception, so a connection error reached
`e.body` and surfaced as an AttributeError instead of a failed
assertion. Narrow both to openai.APIStatusError, which is what a refusal
actually raises (UnprocessableEntityError for 422, RateLimitError for
429), and let anything else propagate as itself.

test_bad_database_url (.circleci/config.yml)

The check required "Database setup failed after multiple retries", which
only the v1 resolver emits, OR uvicorn's "Application startup failed.
Exiting.". With v2 the default, the first branch is dead and the whole
assertion rests on an incidental uvicorn line that HEAD's run did not
emit at all.

Assert the behaviour instead of the wording: the container exits
non-zero, the log names the unreachable server (P1001), it never reaches
"Application startup complete", and it is not left running. The exit
code was previously discarded by `|| true`, so the one thing the job
most needed to check was never checked.

Verified by running the bad-DATABASE_URL container: exit 3, P1001
present, no startup-complete line, container stopped — the new check
passes and the old one passed only by the uvicorn line's accident.
2026-09-21 15:00:54 -07:00
..
test_e2e_budgeting.py test: fix stale budget-status and bad-database-url assertions 2026-09-21 15:00:54 -07:00
test_e2e_model_access.py refactor(proxy): replace configurable model access denied message with a fixed clean client message 2026-09-16 01:44:36 +00:00
test_guardrails.py test: reject assertions on a caught error inside except (ruff PT017) 2026-08-21 13:35:08 -07:00
test_key_logging_callbacks.py [Fix] Proxy: Break managed-resources import cycle on Python 3.13 2026-05-04 20:05:24 -07:00
test_model_info.py [Feat] Allow setting supports_vision for Custom OpenAI endpoints + Added testing (#5821) 2024-09-21 11:35:55 -07:00
test_moderations.py test_basic_moderations_on_proxy_with_model 2025-10-27 13:49:47 -07:00
test_otel.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00
test_prometheus.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_rerank.py fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00
test_team_member_permissions.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_team_tag_routing.py fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00