Repository navigation
test: update stale integration and guardrail e2e tests to intended behavior - #48665
Merged
Merged
Conversation
…avior Each expectation moved because a merged PR changed behavior on purpose. - chatgpt string input is wrapped as one user message (#41522) - Gemini 2.5 tool media sits beside function_response (#48428) - sampling knobs move to Gemini 3.5 Flash, which keeps them (#47645) - a body base_model is stripped without allow_client_pricing_override (#47639) - ai_decide answers without usage return usage null (#48261) - azure_ai forwards mapped client anthropic-beta values (#48033) - the OpenCode scripted upstream mints a fresh id per request
GuardrailDeleteModal requires the exact name before Delete enables since #45893. All three guardrail delete flows now go through one helper.
Contributor
Author
|
bugbot run |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…t a 400 for a non-object body OpenTelemetry 1.45 (#48055) sets the W3C random trace id flag on new traces, so the gateway's traceresponse now ends in -03. The producer copies the server span's own trace flags, so the tests now accept any two-digit flags with the sampled bit set instead of pinning -01 #48438 made a non-object JSON body a 400 "Invalid JSON payload: expected an object" on purpose, so the [1] body case is renamed non_object_body and expects that 400
…in the langtrace outage test The outage test waited for "Exception while exporting Span batch" in the proxy log, which is OpenTelemetry's wording and no longer appears with 1.45. The test keeps asserting what the gateway guarantees, callers unaffected during the outage, a live gateway, and every span after recovery delivered once with no outage span duplicated
Since #47611 a streamed /v1/responses disconnect writes its own spend row, so the concurrent disconnect test saw 20 rows where it counted 10 by model group. It now reads each row's call type and expects ten acompletion rows with the outage verdict and ten aresponses rows with success. /v1/messages disconnects still write no row on main, so they are left out of the count rather than pinned as absent The responses-httpx case of the single disconnect test no longer needs its LIT-8603 skip and passes
K4 boots three two-worker proxies in a row. On CircleCI each boot takes 43 to 58 seconds, so a passing run took 179.97s against its fixed 180s cap and 6 of 30 runs hit pytest-timeout. The cap and the restart gate wait now come from readiness_seconds and graceful_stop_seconds, like other multi-boot tests
Contributor
Author
|
bugbot run |
Contributor
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 41bc6ca. Configure here.
yuneng-berri
enabled auto-merge (squash)
October 28, 2026 01:07
yucheng-berri
approved these changes
Oct 28, 2026
This was referenced Oct 31, 2026
6 of 7 tasks
DeoLeung
pushed a commit
to aiyou178/litellm
that referenced
this pull request
Nov 5, 2026
…hat rc/1.108.0 needs rc/1.108.0 carries OpenTelemetry 1.45.1 (BerriAI#48055), BerriAI#47611 and the BerriAI#47639 base_model strip, so the OTel traceresponse header, langtrace outage, guardrail concurrent-disconnect and Bedrock lookaround tests expected the old behavior. This takes BerriAI#48665's hunks for those four files only, without the unhandled to non_object_body rename, which depends on BerriAI#48438 that rc does not have (cherry picked from commit 21ab2cb, four test files only)
19 tasks done
devin-ai-integration Bot
added a commit
that referenced
this pull request
Nov 23, 2026
…age_test_lts_1_108_x test(decisions): expect null usage on the Databricks systemone answer on lts/1.108.x (#48665)
mateo-berri
pushed a commit
to zoveki/litellm
that referenced
this pull request
Nov 24, 2026
…, as on main (BerriAI#48665) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
mateo-berri
pushed a commit
to zoveki/litellm
that referenced
this pull request
Nov 25, 2026
Backport the affected integration tests from BerriAI#53940, BerriAI#49310, BerriAI#54111, BerriAI#48665, and BerriAI#49667. Upstream commits: 96ae5fa, fbd126e, c90dfea, 21ab2cb, da04c60 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The hourly integration run and the UI e2e job on main went red after several merged PRs changed behavior on purpose, while their tests kept expecting the old behavior. This updates those tests to what the code does now and changes no product code. All guardrail delete flows in the UI suite now share one helper, and one slow restart test now takes its timeout from the harness boot budget instead of a fixed 180 seconds
Details
TLDR
Problem this solves:
How it solves it:
-01Which PR changed each behavior
providers/test_chatgpt_responses_caller_stream_wire.py, string input x1inputas one user message, so the vendor answers instead of returning 400providers/test_gemini_tool_result_part_reference_wire.py, multimodal x3function_responsefor pre Gemini 3 models, and the backend here is gemini-2.5-flashtranslation/*/sampling/test_*_sampling_gemini.pyx5,providers/test_vertex_gemini_function_call_wire.pyx1,providers/test_vertex_gemini_fragmented_stream_wire.pyx1supports_sampling_params: false, so temperature and top_k now get a 400 without drop_paramscandidate_countinstead oftop_kproviders/test_bedrock_converse_lookaround_regex_wire.py, client base model x1base_modelunless the key or team hasallow_client_pricing_override, so it no longer changes the lookaround decisionproviders/test_databricks_decisions_wire.pyx3usage: nullwhen upstream sends none. That PR updatedtest_decisions_wire.pybut not this filemessages_endpoint/providers/anthropic/test_anthropic_safeguards_beta_wire.py, azure_ai D9 and D13anthropic-betato azure_ai on native Messages. The expectation is now built from theazure_aicolumn ofanthropic_beta_headers_config.jsonplus the derived beta, so a config edit does not break itpricing/test_opencode_go_reported_cost_wire.py, flakychatcmpl-goandmsg_goid for the stream and non-stream cases. When both ran on one worker, the second spend row was dropped as a duplicate request id and the test timed out. Each reply now gets a fresh id. Product dedup behavior is unchangedtests/e2e/ui/tests/guardrails/guardrails.spec.tsx2 andpresidioUserStory.spec.tsx1observability/test_otel_trace_response_header.pyx25traceresponsenow ends in-03. The producer copies the server span's own trace flags, so the tests accept any two-digit flags with the sampled bit set instead of pinning-01Invalid JSON payload: expected an objecton purpose, so the[1]body case is nownon_object_bodyand expects that 400. It was the suite's only way into the unhandled exception handler, so that path has no integration case anymoreobservability/test_langtrace_delivery.py, sink outage x1Exception while exporting Span batchlog line, which no longer shows up with 1.45 (fix(ci): unblock dependency security checks #48055). It now asserts only what the gateway owns. Callers are unaffected during the outage, the gateway stays live, and after recovery every span lands once with no outage span duplicatedobservability/test_guardrail_effects.py, concurrent disconnects x1/v1/responsesdisconnect, so the test sees ten Responses rows next to the ten chat rows. It now reads each row's call type and expects tenacompletionrows with the outage verdict and tenaresponsesrows with success./v1/messagesdisconnects still write no row on main, so they are left out of the count rather than pinned as absentresponses-httpxcase of the single disconnect test drops its LIT-8603 skip, which fix(proxy): bill partial Responses API streams when the client disconnects #47611 resolvedobservability/test_logging_only_scope_chaos.py, K4 flakyreadiness_secondsandgraceful_stop_seconds, the wayspend/test_spend_log_caller_session.pysizes its ownUser Flow
Before: a maintainer watching main sees the hourly runs fail on tests whose behavior changed on purpose
integrationande2e_ui_testingjobs on these testsAfter: the same runs pass these tests, so a red run points at a real change
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
These are tests-only changes, so the proof is each test red at the merge base and green at the tip. The integration tests only exist against the harness's scripted upstreams, so no paid provider calls are involved. Integration runs use
tests/integration/run.pywith two workers, where each worker owns its database, Redis, scripted upstream and proxy, on a throwaway local Postgres.LITELLM_LICENSEis set because one databricks case covers a team member flow behind the license. The Python environment is synced from the lockfile, so OpenTelemetry is the locked 1.45.1The OpenCode flake depends on two cases landing on one worker, which a normal run does not do every time. To make it deterministic, both sides also ran this throwaway file, never committed, that sends the stream and the non-stream request through one worker
K4 cannot finish on macOS, because
psutil.net_connectionsneeds root there, so its Before comes from main's CircleCI runs. The UI specs ran against one localtests/e2e/ui/run_e2e.shstack started withE2E_KEEP_ALIVE=1and a license. Product code is the same on both sides, so only the spec files differ. Specs ran with--retries=0 --workers=1, like CIBefore (c4c2fe6)
The 5 errors are the sampling cases' teardown noticing their queued provider reply was never requested, the same pairing CI shows
ChatGPT string input
test_string_input_is_refused_by_the_vendor_as_a_400fails withassert 200 >= 400, the vendor answered because the gateway now wraps the stringGemini 2.5 tool media
{'function_response': {...}}, {'inline_data': {...}}as sibling parts, while the test expectedinline_datanested underfunction_response.partsGemini and Vertex sampling knobs
assert [] == [('POST', '.../gemini-3.8-flash:generateContent')], nothing reached the providerUnsupportedParamsError: gemini-3.7-flash does not support top_k: the model map flags it supports_sampling_params: falsevertex_ai does not support parameters: ['temperature'], for model=gemini-3.7-flashBedrock body base_model
[client-base-model-can-loosen-an-unflagged-deployment]fails, the schema reached Bedrock unchanged because the bodybase_modelwas strippedDatabricks decisions usage
'usage': Nonecame back where the test expected{'input_tokens': 0, 'output_tokens': 0}azure_ai anthropic-beta
assert 'context-management-2025-06-27,dangerous-tool-use-2026-09-03,interleaved-thinking-2025-05-14' == 'dangerous-tool-use-2026-09-03'assert 'context-management-2025-06-27,interleaved-thinking-2025-05-14' == NoneOpenCode reused response id
python tests/integration/run.py accounting --workers 2 tests/integration/pricing/test_zz_opencode_same_worker_scratch.pyAssertionError: State did not converge: [], the second request has no spend rowOpenTelemetry traceresponse flags
_namedwithAssertionError: ['00-79f55b1fabcbceabc974cfce7e9053cf-d488d0965d69343e-03'], a well formed header whose flags are03where the test pins01Non-object body error
test_an_error_response_names_its_own_server_span[unhandled]fails withassert 400 == 500and the body{"error":{"message":"Invalid JSON payload: expected an object","type":"invalid_request_error","param":"request_body","code":"400"}}Langtrace sink outage
test_langtrace_sink_outage_mid_burst_recovers_on_the_same_portfails withState did not converge: 0, theException while exporting Span batchlog line never showed upConcurrent disconnect spend rows
test_concurrent_disconnects_during_a_guardrail_outage_each_record_exactly_one_verdicttimes out waiting for exactly 10 rows. 20 landed, tenacompletionrows withguardrail_failed_to_respondand tenaresponsesrows withsuccessK4 restart timeout
integration-extensionsjunit of the hourly main run at db9eda1 (2026-10-26 4:09 PM PT)Failed: Timeout (>180.0s) from pytest-timeoutwhile waiting on the second wave attest_logging_only_scope_chaos.py:706owned-proxy-*.startup.jsonartifacts from the container that ran K4 show every two-worker proxy taking 43 to 58 seconds to become readyGuardrail delete in the Admin UI
This run used the earlier merge base 2a9c630. Nothing under
tests/e2e/ui/tests/guardrails,tests/e2e/ui/helpers,ui/litellm-dashboard/srcorlitellm/proxy/guardrailschanged between it and c4c2fe6npx playwright test --config playwright.config.ts --retries=0 --workers=1 tests/guardrails/guardrails.spec.ts tests/guardrails/presidioUserStory.spec.tslocator.click, the Delete button resolves to<button disabled ...>Delete</button>because nothing was typedAfter (41bc6ca)
Every touched file runs whole here, apart from
test_guardrail_effects.pywhere only the two changed tests run. The 2 skips are the Messages Anthropic SDK and native Gemini cases of the single disconnect test, which keep their bug skipsChatGPT string input
test_string_input_reaches_the_vendor_as_one_user_messagepasses, the vendor got[{"role": "user", "content": ...}]and the caller got the JSON answer with a spend rowGemini 2.5 tool media
function_response, along with the other 102 cases in the fileGemini and Vertex sampling knobs
temperatureingenerationConfig, and the 3.8 Flashreasoning_effortcase still passescandidate_countingenerationConfigBedrock body base_model
test_a_base_model_in_the_request_body_leaves_the_deployment_decisionpasses for both rows, the deployment alone decides the schemaDatabricks decisions usage
usage: nullazure_ai anthropic-beta
azure_aicolumn maps, plus the derived beta when safeguards are sentOpenCode reused response id
python tests/integration/run.py accounting --workers 2 tests/integration/pricing/test_zz_opencode_same_worker_scratch.py tests/integration/pricing/test_opencode_go_reported_cost_wire.pyOpenTelemetry traceresponse flags
Non-object body error
test_an_error_response_names_its_own_server_span[non_object_body]passes, the 400 carries atraceresponsethat names its server spanLangtrace sink outage
test_langtrace_sink_outage_mid_burst_recovers_on_the_same_portpasses, the outage burst answers every caller and the revived sink gets each new span onceConcurrent disconnect spend rows
test_concurrent_disconnects_during_a_guardrail_outage_each_record_exactly_one_verdictpasses with tenacompletionoutage rows and tenaresponsessuccess rowstest_client_disconnect_mid_stream_records_the_post_call_verdict_on_the_spend_row[responses-httpx]passes now that its skip is goneK4 restart timeout
python tests/integration/run.py extensions --workers 2 tests/integration/observability/test_logging_only_scope_chaos.py::test_K4_proxy_restart_after_fifteen_responses_records_lost_idstest_logging_only_scope_chaos.py:697, withpsutil.AccessDenied, which macOS raises without root. The full run only happens on main's Linux CircleCIGuardrail delete in the Admin UI
This run used fb4776b, whose guardrail specs and helpers match the tip
npx playwright testcommandType
✅ Test
Caveats (if any)
Low
/v1/messagesrowsbuildkite/e2e-testsandosv-scanare red on other open PRs tooAssumeRoleWithWebIdentityAccessDeniedQA runbook
Guardrail "<name>" deleted successfully, the row gone, and GET /v2/guardrails/list no longer listing itrun_e2e.shstartsFinal Attestation
Note
Low Risk
Test and assertion updates only; no runtime or API behavior is modified in this PR.
Overview
Tests-only PR that updates failing integration and Playwright specs so they assert what the gateway does after recent merges—no product code changes.
Guardrail UI deletes now go through a shared
deleteGuardrailFromTablehelper that confirms deletion by typing the guardrail name, matching the new delete dialog.Integration expectations are refreshed across providers and observability: string
/v1/responsesinput is a single user message; Gemini tool multimodal parts sit besidefunction_response; sampling cases use Gemini 3.5 Flash (3.6+ drops sampling knobs); Bedrock no longer treats bodybase_modelas loosening lookaround; Databricksusagecan benull; azure_ai Messages forwards clientanthropic-betavalues mapped fromanthropic_beta_headers_config.json; OpenCode wire mocks use unique response IDs to avoid spend dedup flakes; OTELtraceresponseaccepts any sampled W3C flags and non-object JSON bodies expect 400; Langtrace outage no longer waits for a specific OTEL export log line; disconnect/guardrail spend assertions split rows bycall_type(including streamed Responses); K4 chaos timeout scales with harnessreadiness_seconds/graceful_stop_seconds.Reviewed by Cursor Bugbot for commit 41bc6ca. Bugbot is set up for automated code reviews on this repo. Configure here.