This repository uses three test layers. Only the live HTTP layer should be treated as the source of truth for LibreChat compatibility.
tests/
├── unit/ # mocked component logic
├── integration/ # in-process FastAPI wiring and contract checks
├── functional/ # live HTTP coverage against a running API
└── snapshots/ # reference payloads
- Mock Redis, S3, sandboxing, and other infrastructure.
- Fast feedback for service logic.
- No external stack required.
- Exercise the FastAPI app in-process via
TestClient. - Validate routing, auth, request parsing, response shape, and thin wiring.
contract_onlytests live here.- These tests are not end-to-end compatibility proof.
- Exercise a running API over real HTTP.
- Cover sessions, files, downloads, state continuity, PTC, and concurrency.
client_replaytests mirror the currentlibrechat-agentsruntime flow.- This layer is the primary compatibility signal for LibreChat support.
contract_only: in-process contract and wiring checks.live_api: any test that hits a running API.client_replay: runtime-faithful client replay against the live API.slow: heavier scenarios for dedicated CI jobs.
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install pytest pytest-asyncio pytest-cov pytest-mockFor live API coverage:
cp .env.example .env
docker compose up -dpytest tests/unit/ tests/integration/API_BASE="http://localhost:8000" \
API_KEY="your-secure-api-key-here-change-this-in-production" \
pytest tests/functional/ -m live_api -vAPI_BASE="http://localhost:8000" \
API_KEY="your-secure-api-key-here-change-this-in-production" \
pytest tests/functional/ -m client_replay -vpytest -m contract_only
pytest -m slow
pytest -m "live_api and not slow"- Direct
/execand file lifecycle compatibility:tests/functional/test_client_replay.py - PTC runtime replay:
tests/functional/test_client_replay.py - File contracts and reuse:
tests/functional/test_files.py - Generated artifact integrity:
tests/functional/test_generated_artifacts.py - Mounted file edit persistence:
tests/functional/test_mounted_file_edits.py
If a mocked integration test passes but a live_api or client_replay test fails, treat the live failure as authoritative.
GitHub Actions uses two workflow tiers:
ci.yml: required PR checks for static analysis, unit tests, and integration testsrelease.yml: publishes the multi-arch app image consumed bydocker-compose.yml(defaultAPI_IMAGE) after per-arch smoke validation