mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-12 03:48:56 +00:00
* feat(lens): isolate trace storage and investigation in a Rust service
* fix(lens): include Rust sources in the image build context
* feat(lens): wire service setup, scoped delivery receipts and lease attempts
* fix(lens): complete service routing and reject stale investigation results
* fix(lens): retry key propagation and validate isolated Compose setup
* fix(lens): seed through isolated ingestion and preserve upstream queue fixes
* chore: sync schema.prisma copies from root
* fix(lens): bind nullable due timestamps as text for Prisma
* chore(ui): remove stale lint suppressions
* fix(lens): address CI failures and review findings
* refactor(lens): remove retired Python worker and run evaluations in Rust
* fix(lens): reuse control connections and satisfy review checks
* test(lens): install and upgrade both Helm charts on Kubernetes
* test(lens): run connection reuse coverage as an integration test
* fix(ui): upgrade Next.js to 16.3.8 security release
* fix(lens): fence stale attempts and preserve reviewed evidence
* Revert "fix(ui): upgrade Next.js to 16.3.8 security release"
This reverts commit 2f79a51b25.
* fix(lens): stop failed investigations and stream history excerpts
* test(lens): cover model tool and result contracts
* test(lens): fix retired routes and reuse installation build artifacts
* test(lens): use portable grep in Helm installation smoke
* test(lens): wait for migrations before forwarding Helm services
* fix(lens): keep failed evidence reads retryable
* fix(lens): preserve sandbox output during process exit
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
46 lines
2.1 KiB
Python
46 lines
2.1 KiB
Python
import asyncio
|
|
from typing import Final
|
|
|
|
import pytest
|
|
|
|
from litellm.tracing.remote import LensConnection
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_control_requests_reuse_connections_without_retaining_another_service_credential() -> None:
|
|
requests: Final[asyncio.Queue[tuple[str, bytes]]] = asyncio.Queue()
|
|
|
|
async def serve(reader: asyncio.StreamReader, writer: asyncio.StreamWriter) -> None:
|
|
try:
|
|
while True:
|
|
headers: Final = await reader.readuntil(b"\r\n\r\n")
|
|
requests.put_nowait((str(writer.get_extra_info("peername")), headers))
|
|
writer.write(b"HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\n{}")
|
|
await writer.drain()
|
|
except asyncio.IncompleteReadError:
|
|
pass
|
|
finally:
|
|
writer.close()
|
|
await writer.wait_closed()
|
|
|
|
async with await asyncio.start_server(serve, "127.0.0.1", 0) as server:
|
|
port: Final = server.sockets[0].getsockname()[1]
|
|
first: Final = LensConnection(f"http://127.0.0.1:{port}/one", "first-service-token")
|
|
second: Final = LensConnection(f"http://127.0.0.1:{port}/two", "second-service-token")
|
|
try:
|
|
for connection in (first, second):
|
|
response: Final = await connection.control_client().get(
|
|
connection.endpoint("/internal/status"), headers=connection.headers
|
|
)
|
|
assert response.json() == {}
|
|
first_peer, first_request = await asyncio.wait_for(requests.get(), 2)
|
|
second_peer, second_request = await asyncio.wait_for(requests.get(), 2)
|
|
assert first_peer == second_peer
|
|
assert b"GET /one/internal/status " in first_request
|
|
assert b"GET /two/internal/status " in second_request
|
|
assert b"Bearer first-service-token" in first_request
|
|
assert b"Bearer second-service-token" not in first_request
|
|
assert b"Bearer second-service-token" in second_request
|
|
assert b"Bearer first-service-token" not in second_request
|
|
finally:
|
|
await second.control_client().aclose()
|