Single-commit clean baseline after security scrub of niche-tells, project codenames, internal jargon, and contributor-email leaks. Contents: - 100 Rust crates (_primitives/_rust/) - 37 agent manifests (_manifests/) + generated specs (_generated/) - 67 user-invocable skills (skills/) - 33 hooks (hooks/) - Composition blocks (_blocks/) - Documentation (docs/, README.md) - TS adapter packages (_ts_packages/) - Assembler (_assembler/) - Roles (_roles/) - Templates (_templates/) - Forgejo CI (.forgejo/) Author: Denis Parfionovich <info@greendragon.info> License: see LICENSE.
24 lines
867 B
Rust
24 lines
867 B
Rust
//! `is_running` returns `false` when nothing listens on the given URL.
|
|
//!
|
|
//! We bind a TCP listener on an ephemeral loopback port, drop it (releasing the
|
|
//! port), and point the client at that now-unbound URL. The connection refuses
|
|
//! immediately on every modern OS — we don't have to wait for any timeout.
|
|
|
|
use std::net::TcpListener;
|
|
|
|
use kei_llm_ollama::{is_running, Client};
|
|
|
|
fn unbound_url() -> String {
|
|
let listener = TcpListener::bind("127.0.0.1:0").expect("bind ephemeral");
|
|
let addr = listener.local_addr().expect("local_addr");
|
|
drop(listener);
|
|
format!("http://127.0.0.1:{}", addr.port())
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn is_running_false_when_nothing_listening() {
|
|
let url = unbound_url();
|
|
let client = Client::new(url);
|
|
let alive = is_running(&client).await;
|
|
assert!(!alive, "expected is_running == false on dead port");
|
|
}
|