The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(tests): restore proxy_server.master_key in realtime fixture; add shard-coverage guard
Yuneng Jiang32c390a0f6af
diff --git a/.github/workflows/test-unit-proxy-db.yml b/.github/workflows/test-unit-proxy-db.ymlindex f8d5bc265a7..0f2694984e0 100644--- a/.github/workflows/test-unit-proxy-db.yml+++ b/.github/workflows/test-unit-proxy-db.yml@@ -25,7 +25,50 @@ concurrency:# pinning the whole file to a single worker (the default --dist=loadscope# behavior for single-file targets).jobs:+ # Fast guard — fails the workflow if a test_*.py file under+ # tests/proxy_unit_tests/ is not referenced by any matrix entry below.+ # The semantic-shard design (no catch-all "remaining" bucket) relies on+ # every test file being explicitly assigned; this guard prevents a new+ # file from silently dropping out of CI.+ assert-shard-coverage:+ runs-on: ubuntu-latest+ timeout-minutes: 2+ permissions:+ contents: read+ steps:+ - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0+ with:+ persist-credentials: false+ - name: Assert every test_*.py is in a matrix shard+ run: |+ python3 - <<'PY'+ import pathlib, re, sys, yaml+ wf = yaml.safe_load(open(".github/workflows/test-unit-proxy-db.yml"))+ matrix = wf["jobs"]["proxy-db"]["strategy"]["matrix"]["include"]+ referenced = set()+ for entry in matrix:+ for token in entry["test-path"].split():+ if token.startswith("tests/proxy_unit_tests/"):+ referenced.add(pathlib.PurePosixPath(token).name)+ actual = {p.name for p in pathlib.Path("tests/proxy_unit_tests").iterdir()+ if p.name.startswith("test_") and (p.suffix == ".py" or p.is_dir())+ and p.name != "test_configs"}+ orphans = sorted(actual - referenced)+ if orphans:+ print("ERROR: the following files/dirs under tests/proxy_unit_tests/")+ print(" are not assigned to any shard in test-unit-proxy-db.yml:")+ for o in orphans:+ print(f" - {o}")+ print()+ print("Add each to whichever semantic shard (auth-and-jwt, proxy-server,")+ print("logging-and-callbacks, db-and-spend, guardrails-budget-hooks,")+ print("endpoints-and-responses, proxy-utils, key-generation) it belongs to.")+ sys.exit(1)+ print(f"OK: all {len(actual)} files assigned to a shard.")+ PY+proxy-db:+ needs: assert-shard-coveragepermissions:contents: readid-token: writediff --git a/tests/test_litellm/proxy/realtime_endpoints/test_realtime_webrtc_endpoints.py b/tests/test_litellm/proxy/realtime_endpoints/test_realtime_webrtc_endpoints.pyindex e414f975f55..99b6335ce8a 100644--- a/tests/test_litellm/proxy/realtime_endpoints/test_realtime_webrtc_endpoints.py+++ b/tests/test_litellm/proxy/realtime_endpoints/test_realtime_webrtc_endpoints.py@@ -116,8 +116,16 @@ def test_decode_realtime_token_payload_ephemeral_key_not_string():def proxy_app():from litellm.proxy import proxy_server+ # master_key is a module-global — restore it on teardown so this fixture+ # doesn't leak state into unrelated tests that share the same xdist worker+ # (e.g. tests that assume master_key is None and send unauthenticated+ # requests to the shared FastAPI app).+ original_master_key = proxy_server.master_keyproxy_server.master_key = "sk-test-master-key"- return proxy_server.app+ try:+ yield proxy_server.app+ finally:+ proxy_server.master_key = original_master_key@pytest.fixture