mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
The shared proxy wrapper in tests/e2e/e2e_gateway.py was misnamed: Gateway is not a gateway server, it is the client every suite uses to talk to the proxy (keys, models, chat/embed/ocr, spend read-backs, poll helpers). Rename the module to proxy_client.py and the class to ProxyClient, with build_gateway becoming build_proxy_client and the GatewayProvider protocol becoming ProxyClientProvider. The .gateway attribute suites held is now .proxy. Only identifiers changed; prose and string literals that use the word gateway for the proxy-server concept were left alone. Each suite previously built its own instance through a per-suite build_client() that called build_gateway() inside, duplicating the proxy wiring across suites. There is now one session-scoped proxy fixture in tests/e2e/conftest.py; every suite's client fixture depends on it and injects it, so the wiring lives in one place. claude_code keeps building its own client directly since it has its own harness and does not use the shared fixtures. Behavior is unchanged: shared transport, data-plane/control-plane split routing, poll budget, typed request/response models, and resource cleanup all go through the same object.
59 lines
1.9 KiB
Python
59 lines
1.9 KiB
Python
"""Fixtures for the logging e2e suite.
|
|
|
|
Missing proxy, provider keys, or integration credentials are hard failures.
|
|
Never pytest.skip from this suite for environment gaps.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
import pytest
|
|
|
|
from logging_client import LangfuseCreds, LoggingClient, build_logging_client, load_langfuse_creds
|
|
from datadog_reader import DdLogsReader, build_dd_logs_reader
|
|
from otel_client import OtelReader, build_otel_reader
|
|
from proxy_client import ProxyClient
|
|
|
|
|
|
def pytest_configure(config: pytest.Config) -> None:
|
|
config.addinivalue_line(
|
|
"markers",
|
|
"covers: registry cell a test covers, e.g. logging.langfuse.success.logs_spend",
|
|
)
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def client(proxy: ProxyClient) -> LoggingClient:
|
|
"""The logging suite's client: holds the shared ProxyClient so `resources` /
|
|
`scoped_key` clean up keys and teams, and adds `/metrics` scraping plus
|
|
Langfuse read-back."""
|
|
return build_logging_client(proxy)
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def otel_reader() -> OtelReader:
|
|
"""Read-back client for the compose stack's Jaeger trace destination."""
|
|
return build_otel_reader()
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def dd_logs() -> DdLogsReader:
|
|
"""Read-back client for the real DataDog Logs Search API (keys from the
|
|
secret manager on the cluster, tests/e2e/.env locally)."""
|
|
return build_dd_logs_reader()
|
|
|
|
|
|
@pytest.fixture
|
|
def datadog_creds() -> None:
|
|
"""Require Datadog shipping credentials. Hard-fail when absent; never skip."""
|
|
if not (os.getenv("DD_API_KEY") and os.getenv("DD_SITE")):
|
|
pytest.fail(
|
|
"Datadog e2e requires DD_API_KEY and DD_SITE; missing credentials is a hard failure, not a skip"
|
|
)
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def langfuse_creds() -> LangfuseCreds:
|
|
"""Require real Langfuse cloud credentials for team callback + trace poll."""
|
|
return load_langfuse_creds()
|