Add 5s timeout to models list call + integration test (#8942)

- Enforce a 5s timeout around the remote models refresh to avoid hanging
/models calls.
This commit is contained in:
Ahmed Ibrahim
2026-01-08 18:06:10 -08:00
committed by GitHub
parent 51dd5af807
commit 81caee3400
3 changed files with 101 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
use std::sync::Arc;
use std::sync::Mutex;
use std::time::Duration;
use anyhow::Result;
use base64::Engine;
@@ -674,6 +675,24 @@ pub async fn mount_models_once(server: &MockServer, body: ModelsResponse) -> Mod
models_mock
}
pub async fn mount_models_once_with_delay(
server: &MockServer,
body: ModelsResponse,
delay: Duration,
) -> ModelsMock {
let (mock, models_mock) = models_mock();
mock.respond_with(
ResponseTemplate::new(200)
.insert_header("content-type", "application/json")
.set_body_json(body.clone())
.set_delay(delay),
)
.up_to_n_times(1)
.mount(server)
.await;
models_mock
}
pub async fn mount_models_once_with_etag(
server: &MockServer,
body: ModelsResponse,