litellm/tests/unit/rust_bridge/test_clickhouse.py
moe-berri 22ad3c5fff
refactor(lens): connect LiteLLM to the independent Lens service (#45529)
* feat(lens): consume the independent Lens service and shared UI

* fix(lens): keep embedded setup stable and vendor UI before builds

* chore(lens): pin embedded UI provenance to published Lens source

* fix(lens): complete embedded UI extraction across CI builds

* docs(lens): record latest main and removal-boundary validation

* fix(lens): wire external chart credentials and ingestion modes

* test(lens): cover adapter failures and fix extraction CI

* docs(lens): refresh bundled chart setup instructions

* test(lens): restore gateway adapter test package marker

* build(lens): pin clean-cut UI and supported storage chart

* test(ui): await guardrail scope menu before checking options

* perf(lens): omit unused trace-team lookup from product requests

* docs(lens): record final-image adapter permission checks

* test(lens): assert delegated investigation authorization

* refactor(lens): remove copied trace runtime and preserve spend logging

* test(lens): verify independent gateway image upgrades and outages

* test(lens): pin the chart qualification database image

* fix(lens): update embedded UI metadata filters

* test: wait for Lens chart pod identity convergence

* fix(e2e): select Lens chart pods by deployment ownership

* fix(e2e): select Helm migration ownership for Lens upgrades

* test(lens): retain migration Jobs through rollout assertions

* docs(helm): require existing database for migration hooks

* test(lens): qualify release boundaries with embedded navigation update

* docs(lens): record browser qualification for embedded tabs

* fix(lens): remove unrelated CI and guardrail test changes

* test(lens): give qualification tenants unique key aliases

* feat(lens): embed the latest canonical Lens interface

* fix(lens): qualify split inference through the gateway

* fix(lens): preserve scoped auth and isolate delegated credentials

* chore(lens): remove unrelated documentation and lint changes

* fix(lens): bound concurrent forwarding buffers through response delivery

* fix(lens): preserve OAuth2 dispatch without inference policies

* chore(lens): adopt current shared onboarding UI

* fix(lens): refresh shared setup UI and review context

* fix(lens): bound uploads before gateway authentication

* docs(lens): remove extraction evidence from the gateway repo

* docs(lens): refresh shared setup prompt for paired releases
2026-10-09 16:17:05 -07:00

41 lines
1.5 KiB
Python

from typing import Final
import pytest
from litellm.constants import DEFAULT_AGENT_TRACING_RETENTION_DAYS, DEFAULT_CLICKHOUSE_DATABASE
from litellm.rust_bridge.clickhouse import spend_storage_config
def test_spend_storage_preserves_environment_settings_and_hides_credentials() -> None:
config: Final = spend_storage_config(
{
"CLICKHOUSE_URL": "https://writer:private@clickhouse:8443",
"CLICKHOUSE_DATABASE": "analytics",
"AGENT_TRACING_RETENTION_DAYS": "7",
}
)
assert (config.url, config.database, config.retention_days) == (
"https://writer:private@clickhouse:8443",
"analytics",
7,
)
assert "private" not in repr(config)
def test_spend_storage_defaults_remain_gateway_defaults() -> None:
config: Final = spend_storage_config({"CLICKHOUSE_URL": "http://clickhouse:8123"})
assert (config.database, config.retention_days) == (
DEFAULT_CLICKHOUSE_DATABASE,
DEFAULT_AGENT_TRACING_RETENTION_DAYS,
)
@pytest.mark.parametrize("retention", ("0", "-1", str(2**32), "1.5", "invalid"))
def test_spend_storage_rejects_invalid_retention(retention: str) -> None:
with pytest.raises(ValueError, match="positive integer"):
spend_storage_config({"CLICKHOUSE_URL": "http://clickhouse:8123", "AGENT_TRACING_RETENTION_DAYS": retention})
def test_spend_storage_requires_clickhouse_without_lens_configuration() -> None:
with pytest.raises(ValueError, match="CLICKHOUSE_URL is required"):
spend_storage_config({"LITELLM_LENS_URL": "http://lens"})