test: add Phase 3 poller integration tests
Extract public poll_once() from poll_loop() for testability. 4 tests proving the poller correctly discovers models, updates gateway state, marks unreachable nodes unhealthy, and prunes stale models. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,13 +12,18 @@ const POLL_INTERVAL: Duration = Duration::from_secs(10);
|
||||
/// Runs forever, polling all nodes on a fixed interval.
|
||||
pub async fn poll_loop(fleet: Arc<CortexState>) {
|
||||
loop {
|
||||
for nc in &fleet.node_configs {
|
||||
poll_node(&fleet, &nc.name, &nc.endpoint).await;
|
||||
}
|
||||
poll_once(&fleet).await;
|
||||
tokio::time::sleep(POLL_INTERVAL).await;
|
||||
}
|
||||
}
|
||||
|
||||
/// Poll all nodes once. Used by `poll_loop` and available for testing.
|
||||
pub async fn poll_once(fleet: &CortexState) {
|
||||
for nc in &fleet.node_configs {
|
||||
poll_node(fleet, &nc.name, &nc.endpoint).await;
|
||||
}
|
||||
}
|
||||
|
||||
async fn poll_node(fleet: &CortexState, name: &str, endpoint: &str) {
|
||||
let url = format!("{endpoint}/v1/models");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user