Skip to content

Commit

Permalink
add a smoke test
Browse files Browse the repository at this point in the history
  • Loading branch information
rescrv committed Dec 2, 2024
1 parent db9ff9e commit 7591522
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions rust/load/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ impl axum::response::IntoResponse for Error {

pub fn client() -> ChromaClient {
let url = std::env::var("CHROMA_HOST").unwrap_or_else(|_| "http://localhost:8000".into());
client_for_url(url)
}

pub fn client_for_url(url: String) -> ChromaClient {
if let Ok(auth) = std::env::var("CHROMA_TOKEN") {
ChromaClient::new(ChromaClientOptions {
url,
Expand Down Expand Up @@ -654,3 +658,22 @@ pub async fn entrypoint() {
axum::serve(listener, app).await.unwrap();
runner.abort();
}

#[cfg(test)]
mod tests {
use super::*;

#[tokio::test]
async fn end_to_end() {
let load = LoadService::default();
load.start(
"foo".to_string(),
"nop".to_string(),
"get-no-filter".to_string(),
(chrono::Utc::now() + chrono::Duration::seconds(10)).into(),
1.0,
)
.unwrap();
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
}
}

0 comments on commit 7591522

Please sign in to comment.