litellm/.github
cursor-agent adf41853ee
feat(tests): vendor example_openai_endpoint as a local mock server
Adds a vendored copy of BerriAI/example_openai_endpoint under
tests/mock_endpoints/example_openai_endpoint/ together with infrastructure
to run it in-process during a test session, so CI no longer depends on the
public Railway deployment (which has had multiple outages, e.g. the May 19
2026 GCP-account incident that took down 8 CI jobs).

Pieces added:

- tests/mock_endpoints/example_openai_endpoint/  vendored upstream source
  (main.py, batch_and_files_api.py, requirements.txt, Dockerfile),
  intended to be re-vendored as-is from upstream when needed (see README).
- tests/mock_endpoints/__init__.py              helper module exposing
  MOCK_OPENAI_BASE_URL (reads LITELLM_MOCK_OPENAI_BASE_URL with the
  Railway URL as fallback) and start_mock_server() — boots the server as
  a subprocess on a free port, polls /chat/completions until it responds,
  returns an RAII-style handle for teardown.
- tests/mock_endpoints/conftest.py              session-scoped pytest
  fixture mock_openai_endpoint_server that any suite can opt into via
  pytest_plugins.
- tests/mock_endpoints/start_mock_server.sh     bash launcher (foreground
  or --background) for shell-driven workflows.
- tests/mock_endpoints/README.md                local + CI usage docs and
  instructions for re-vendoring from upstream.
- tests/test_litellm/mock_endpoints/            end-to-end smoke tests
  that boot the mock and exercise /chat/completions, /v1/embeddings, and
  the fine-tuning list endpoint.

Wiring:

- New mock-server dependency-group in pyproject.toml (just adds slowapi;
  the rest of the upstream deps already come in via dev/proxy-dev).
- _test-unit-base.yml now syncs --group mock-server so any reusable unit
  test job has the deps available.
- test-unit-misc.yml runs the new smoke tests as part of its path set.
- Makefile gains 'make mock-server' (and an install-mock-server helper)
  for running the server locally with the project venv.

The Railway URL is still the runtime fallback for any test that has not
been migrated, so this PR is non-breaking; follow-up PRs can migrate
hard-coded URLs to use MOCK_OPENAI_BASE_URL / the new fixture.

Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>
2026-05-20 15:57:20 +00:00
..
codeql [Infra] Improve CodeQL scanning coverage and schedule 2026-03-27 12:04:09 -07:00
ISSUE_TEMPLATE docs: document new github + gitlab ci scripts 2026-03-25 20:17:10 -07:00
observatory Add observatory test workflow for RC/stable releases 2026-03-01 15:30:09 -03:00
screenshots fix(team_endpoints): auto-add SSO team members to org on move (proxy admin only) (#26377) 2026-04-24 08:36:25 -07:00
scripts style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
workflows feat(tests): vendor example_openai_endpoint as a local mock server 2026-05-20 15:57:20 +00:00
dependabot.yaml chore: fixes 2026-04-05 01:30:57 -07:00
deploy-to-aws.png Add files via upload 2023-10-25 16:33:53 -07:00
FUNDING.yml Update FUNDING.yml 2023-09-22 09:51:35 -07:00
pull_request_template.md docs: update pull_request_template to add Linear ticket mentioning 2026-04-27 17:31:03 -07:00
template.yaml (chore) cleanup 2024-02-09 09:28:13 -08:00