mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-12 03:48:56 +00:00
* ci: run every CircleCI check from the integration workflow * test(ci): keep the startup test CircleCI-owned * test(ui): find reset log rows by request id so concurrent workers cannot page them out * test(ui): retry the key budget window spec until the draft refresh fix lands * ci(ui): set Playwright workers and retries on the CircleCI command only The shared playwright.config.ts also drives the Buildkite UI suite, where 3 workers ran out of memory on one of two runs. Buildkite keeps main's 1 worker and 2 retries --------- Co-authored-by: yuneng <yuneng@berri.ai>
58 lines
2.5 KiB
Python
58 lines
2.5 KiB
Python
"""
|
|
This test ensures that the proxy starts and serves requests even with a bad license.
|
|
|
|
|
|
in ci/cd config.yml, we set the license to "bad-license"
|
|
"""
|
|
|
|
import os
|
|
from typing import Final
|
|
|
|
import aiohttp
|
|
import pytest
|
|
from tests.integration._support.provider import SharedProvider
|
|
from tests.integration._support.wire import Reply
|
|
|
|
|
|
PROXY_URL: Final = os.environ.get("INTEGRATION_PROXY_URL", "http://0.0.0.0:4000")
|
|
INTEGRATION_RIG: Final = "INTEGRATION_PROXY_URL" in os.environ
|
|
MODEL: Final = "openai/gpt-5.4" if INTEGRATION_RIG else "gpt-4"
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_health_and_chat_completion(provider: SharedProvider) -> None:
|
|
base_url: Final = PROXY_URL.rstrip("/")
|
|
async with aiohttp.ClientSession() as session:
|
|
async with session.get(f"{base_url}/health/readiness") as response:
|
|
assert response.status == 200, await response.text()
|
|
readiness_response: Final = await response.json()
|
|
assert readiness_response["status"] in ("healthy", "connected")
|
|
async with session.get(f"{base_url}/health/liveness") as response:
|
|
assert response.status == 200, await response.text()
|
|
headers: Final = {
|
|
"Authorization": f"Bearer {os.environ['LITELLM_MASTER_KEY']}",
|
|
"Content-Type": "application/json",
|
|
}
|
|
if INTEGRATION_RIG:
|
|
provider.expect(
|
|
Reply(
|
|
status=200,
|
|
body=b'{"id":"chatcmpl-scripted","object":"chat.completion","created":1700000000,"model":"gpt-5.4","choices":[{"index":0,"message":{"role":"assistant","content":"scripted integration reply"},"finish_reason":"stop"}],"usage":{"prompt_tokens":4,"completion_tokens":5,"total_tokens":9}}',
|
|
)
|
|
)
|
|
data: Final = {
|
|
"model": MODEL,
|
|
"messages": [
|
|
{"role": "system", "content": "You are a helpful assistant."},
|
|
{"role": "user", "content": "Hello!"},
|
|
],
|
|
}
|
|
async with session.post(f"{base_url}/chat/completions", headers=headers, json=data) as response:
|
|
assert response.status == 200, await response.text()
|
|
completion_response: Final = await response.json()
|
|
assert "choices" in completion_response
|
|
if INTEGRATION_RIG:
|
|
requests: Final = provider.received()
|
|
assert len(requests) == 1, requests
|
|
assert requests[0].method == "POST", requests[0]
|
|
assert requests[0].target.endswith("/chat/completions"), requests[0]
|