* ci: start fewer jobs per pull request A typical backend pull request started about 104 runners, and many of them only checked out the repo to find their files had not changed. The unit plan job now classifies the change once and skips ui-unit, dashboard-build, redis-compat, python-310 and helm at the job level when their inputs did not change, and the whole backend set on docs-only and UI-only pull requests. unit passed still accepts a skip only for jobs the plan listed. The lint plan does the same for the ui lint job. Smoke runs its six core interpreters and both all-extras environments in one job, installing the venvs in parallel and then running the existing checks in parallel inside the loopback namespace. dashboard-build moves into the unit workflow so the plan can gate it on the dashboard sources and the Dockerfile, its only inputs. ci-coverage, semgrep and the secret scans move into code-quality, the three OpenAI SDK versions run one after another in one job, and the docs job's checks run in lint-runtime. lint-runtime now runs on release-branch pull requests too, where it skips import safety, the OpenAPI gate and the code-quality checks and runs only the docs checks the docs job ran there. * ci: give the smoke job its own uv cache and check CI coverage before the docs checkout The combined smoke job restored the old py3.15 job's uv cache, an exact key hit that main would never overwrite, so Python 3.14 built grpcio-tools from source on every run (4m41s). It now uses its own cache suffix, and each interpreter starts its checks as soon as its own install finishes. The coverage assertions in code-quality saw the litellm-docs checkout's Dockerfile as an unbuilt image, so they now run before that checkout. * ci(smoke): keep 3.14 and 3.15 on their own cached runners Those two interpreters build grpcio-tools and other packages from source when their uv cache misses. Inside the combined job, with an empty cache and six other installs on four CPUs, 3.14 took 13.9 minutes and 3.15 ran past the 20-minute timeout. They now run as py3.14 and py3.15 again, restoring the same per-version caches as before, and core-checks keeps 3.10 to 3.13 and both all-extras environments. * ci(ui): run the dashboard unit tests on 3 shards instead of 6 * ci(ui): run the dashboard unit tests on 4 shards so the full suite stays under 10 minutes
3.6 KiB
tests/integration
Real proxy, Postgres, Redis, scripted upstream. README.md has shards and CI wiring
What good looks like
The root example is from here. The spend row lands async: poll, never sleep
rows = eventually(
lambda: read_rows('SELECT spend FROM "LiteLLM_SpendLogs" WHERE request_id=%s', (body["id"],)),
lambda values: len(values) == 1,
seconds=70,
)
assert float(rows[0]["spend"]) == pytest.approx(10 * 0.001 + 5 * 0.0001 + 7 * 0.002 + 4 * 0.002)
sleep(3) fails on a slow runner and taxes every fast one. Assert the outbound body in the upstream
handler. A leaked field is invisible from the response. monkeypatch.setenv is fine. Patching our own
function in a full stack is not
Where it goes
By the domain a user would name: pricing, spend, routing, mcp. A file only needs to live in a
directory that a GROUPS entry in run.py selects. There is no manifest and no covers marker on new
tests. A product bug the test exposes is pytest.skip("BUG: <symptom>") at the top of the body, not a
fix in the test and not a deletion. Needs no network, proxy, DB or Redis: tests/unit
A test that starts its own process or opens its own socket but needs no proxy also lives here, in a
*_real_io.py file next to the domain it covers, because tests/unit is in-process. It asks for none of
the gateway fixtures, so it runs as plain pytest inside its group
GitHub Actions integration groups run every file here except the OCI and sandbox tests, which no CI runs, and
the files in GITHUB_FILES in run.py. test-integration.yml runs the same groups through the same
run_integration.sh on GitHub Actions, on main at 10am, 2pm and 6pm Pacific Monday to Saturday,
and on a pull request when someone adds the run-ci label. These jobs do not run every pull request, so a new file here
first runs on main after its PR merges, or earlier if the PR gets run-ci. Wanting a file to run before merge
is no reason to change CI, and a new
dedicated workflow for it is the same mistake as a shared shard. Write the file, leave GITHUB_FILES and
every workflow alone, and tell the user it first runs on main. GITHUB_FILES is only for a file that
needs what GitHub Actions groups cannot give it, like the images image-scan.yml builds. test_roi_observed.py previously needed a dedicated plain pytest
job and now has no CI owner. It is listed explicitly in the coverage allowlist. Add a file to GITHUB_FILES only when needed,
together with its dedicated job, and list a new dedicated GitHub workflow with the directory it owns in
DEDICATED_INTEGRATION_WORKFLOWS in .github/scripts/assert_ci_coverage.py. The coverage check in code-quality
fails a file here that another workflow selects unless that workflow owns its path in
DEDICATED_INTEGRATION_WORKFLOWS (#46780).
Fixtures that boot a proxy
Scope them to the module or class, or pin a session one to a single worker with an xdist_group mark
as _llm_gateway in mcp/test_mcp_llm_endpoints.py does, and request them as arguments, never through
request.getfixturevalue. The harness puts tests that request the same set of module or class fixtures
on one xdist worker, so the proxy they share boots there once and stops when that worker moves to another
file. A test that requests one more of those fixtures than its neighbors gets its own group and can boot
the proxy again on another worker, so keep that set the same across the tests that share a proxy. An
unpinned session fixture boots a copy on every worker that runs one of its tests and keeps them all until
the node ends, and those copies ran GitHub Actions integration-extensions nodes out of memory