mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-11 08:38:24 +00:00
* fix(tracing): use ClickHouse URL for reads by default * fix(tracing): unify ClickHouse storage configuration * fix(tracing): update dashboard setup copy for one URL * test(tracing): make tests/unit/tracing a package Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * refactor(config): drop legacy string tracing store variant Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(tracing): own ClickHouse defaults in constants and reject unset env references Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(tracing): use raw regex patterns in config tests Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(tracing): read ClickHouse env defaults when tracing config resolves Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(ui): split audit log query guard to fit condition-chain budget Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
39 lines
1.2 KiB
Rust
39 lines
1.2 KiB
Rust
use litellm_storage_clickhouse::{Connection, Storage};
|
|
use rstest::rstest;
|
|
|
|
#[rstest]
|
|
#[case::http("http://localhost:8123", true)]
|
|
#[case::https("https://localhost:8443", true)]
|
|
#[case::tcp("tcp://localhost:9000", false)]
|
|
#[case::missing_host("http://", false)]
|
|
fn accepts_only_clickhouse_http_urls(#[case] value: &str, #[case] expected: bool) {
|
|
assert_eq!(Connection::parse(value).is_ok(), expected);
|
|
}
|
|
|
|
#[test]
|
|
fn storage_uses_one_url_for_writes_and_bounded_reads() {
|
|
let storage =
|
|
Storage::new("litellm".to_owned(), "http://localhost:8123").expect("valid ClickHouse URLs");
|
|
|
|
assert_eq!(storage.database(), "litellm");
|
|
assert_eq!(storage.writer().url().host_str(), Some("localhost"));
|
|
assert_eq!(storage.writer().url().port(), Some(8123));
|
|
assert_eq!(storage.reader().url().port(), Some(8123));
|
|
assert_eq!(
|
|
storage
|
|
.reader()
|
|
.url()
|
|
.query_pairs()
|
|
.find(|(key, _)| key == "database")
|
|
.unwrap()
|
|
.1,
|
|
"litellm"
|
|
);
|
|
}
|
|
|
|
#[rstest]
|
|
#[case::empty("")]
|
|
#[case::injection("db; DROP DATABASE default")]
|
|
fn storage_rejects_invalid_database(#[case] database: &str) {
|
|
assert!(Storage::new(database.to_owned(), "http://localhost:8123").is_err());
|
|
}
|