Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test: update host inference and tool registry e2e tests

Steven Enamakelb6f8a22b683b
diff --git a/tests/raw_coverage/host_inference_http_e2e.rs b/tests/raw_coverage/host_inference_http_e2e.rs
index 0cc8920eca..c810928671 100644
--- a/tests/raw_coverage/host_inference_http_e2e.rs
+++ b/tests/raw_coverage/host_inference_http_e2e.rs
@@ -19,7 +19,7 @@ use openhuman_core::config::schema::cloud_providers::{
};
use openhuman_core::config::Config;
use openhuman_core::core::types::AppState;
-use openhuman_core::inference::host_runtime::{local_ai_status, LocalAiService};
+use openhuman_core::inference::host_runtime::local_ai_status;
use openhuman_core::inference::http;
use openhuman_core::security::credentials::{
AuthService, APP_SESSION_PROVIDER, DEFAULT_AUTH_PROFILE_NAME,
@@ -74,18 +74,15 @@ impl Drop for EnvVarGuard {
/// by default. These tests mutate `OPENHUMAN_WORKSPACE`, `OPENHUMAN_OLLAMA_BASE_URL`,
/// and binary path env vars, so every test takes this guard before reading or
/// writing config that may be influenced by process env.
-static ENV_LOCK: &OnceLock<Mutex<()>> = &crate::SHARED_ENV_LOCK;
+static ENV_LOCK: &OnceLock<tokio::sync::Mutex<()>> = &crate::SHARED_ENV_LOCK;
-fn env_lock() -> std::sync::MutexGuard<'static, ()> {
- ENV_LOCK
- .get_or_init(|| Mutex::new(()))
- .lock()
- .unwrap_or_else(|e| e.into_inner())
+async fn env_lock() -> tokio::sync::MutexGuard<'static, ()> {
+ ENV_LOCK.get_or_init(|| tokio::sync::Mutex::new(())).lock().await
}
#[tokio::test]
async fn http_models_and_chat_use_mocked_ollama_without_real_runtime() {
- let _env = env_lock();
+ let _env = env_lock().await;
let (base, state) = serve_mock().await;
let tmp = tempdir().expect("tempdir");
let mut config = temp_config(&tmp);
@@ -101,7 +98,6 @@ async fn http_models_and_chat_use_mocked_ollama_without_real_runtime() {
label: "Round 23".to_string(),
endpoint: format!("{base}/cloud"),
auth_style: CloudAuthStyle::None,
- legacy_type: None,
default_model: Some("[email protected]".to_string()),
}];
config.save().await.expect("save config");
@@ -197,7 +193,7 @@ async fn http_models_and_chat_use_mocked_ollama_without_real_runtime() {
#[tokio::test]
async fn local_service_reports_endpoint_state_from_mocked_ollama_without_spawning() {
- let _env = env_lock();
+ let _env = env_lock().await;
let (base, _state) = serve_mock().await;
let tmp = tempdir().expect("tempdir");
// Runtime binaries on PATH leave a marker if run: OpenHuman probes the
@@ -226,19 +222,8 @@ async fn local_service_reports_endpoint_state_from_mocked_ollama_without_spawnin
let _piper_bin = EnvVarGuard::unset("PIPER_BIN");
let _ollama_bin = EnvVarGuard::unset("OLLAMA_BIN");
- let runtime = openhuman_core::inference::local_runtime_config(&config);
- let service = LocalAiService::new(&runtime);
- service.bootstrap(&runtime).await;
- let status = service.status();
- assert_eq!(status.vision_mode, "ondemand");
- assert_eq!(status.chat_model_id, "gemma3:1b-it-qat");
-
- let diagnostics = service.diagnostics(&runtime).await.expect("diagnostics");
- assert_eq!(diagnostics["expected"]["vision_found"], true);
-
- // No transcription assertion here: `transcribe_with_prompt` is a hosted
- // call to the backend proxy since the whisper.cpp engine was deleted.
-
+ // Exercise the host operation's config projection. It may probe this
+ // loopback endpoint, but must not launch a local runtime binary itself.
let ops_status = local_ai_status(&config).await.expect("ops status").value;
assert_eq!(ops_status.provider, "ollama");
assert!(
diff --git a/tests/raw_coverage/tool_registry_approval_e2e.rs b/tests/raw_coverage/tool_registry_approval_e2e.rs
index 5fa83d8581..b9e6f9ea5e 100644
--- a/tests/raw_coverage/tool_registry_approval_e2e.rs
+++ b/tests/raw_coverage/tool_registry_approval_e2e.rs
@@ -30,7 +30,7 @@ use openhuman_core::security::approval::{
};
use openhuman_core::security::turn_origin::{self, AgentTurnOrigin};
use openhuman_core::security::{live_policy, SecurityPolicy};
-use openhuman_core::tools::registry::{registry_entries, registry_entries_for_config};
+use openhuman_core::tools::registry::registry_entries_for_config;
use openhuman_rpc::server::build_core_http_router;
use tinytools::registry::denials;