Skip to content

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

test(all): add test fixtures for channels and cron scheduling

Steven Enamakelb18bdd468c33
diff --git a/crates/openhuman-core/src/channels/mod.rs b/crates/openhuman-core/src/channels/mod.rs
index 8c95df4963..7d9e068266 100644
--- a/crates/openhuman-core/src/channels/mod.rs
+++ b/crates/openhuman-core/src/channels/mod.rs
@@ -33,6 +33,8 @@ pub(crate) mod prompt;
pub mod providers;
#[cfg(feature = "channels")]
mod routes;
+#[cfg(test)]
+pub(crate) use routes::register_hosted_route_test_policy;
#[cfg(feature = "channels")]
mod runtime;
#[cfg(feature = "channels")]
diff --git a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
index 752e7f76d0..72bcf1d258 100644
--- a/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
+++ b/crates/openhuman-core/src/channels/tests/runtime_tool_calls.rs
@@ -74,6 +74,7 @@ async fn process_channel_message_executes_native_tool_calls() {
#[tokio::test]
async fn process_channel_message_handles_models_command_without_llm_call() {
+ crate::channels::register_hosted_route_test_policy();
let _bus_guard = super::common::use_real_agent_handler().await;
let channel_impl = Arc::new(TelegramRecordingChannel::default());
let channel: Arc<dyn Channel> = channel_impl.clone();
diff --git a/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs b/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs
index f128e93edf..ad6d79110f 100644
--- a/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs
@@ -328,6 +328,7 @@ async fn run_agent_job_returns_error_without_provider_key() {
#[tokio::test]
async fn cron_agent_job_uses_agent_definition_tool_scope() {
+ crate::agent::session_host::test_support::install_model_fixture();
// The embedding seam fails loudly when unwired. Installed here rather
// than relied upon from another test: `install_for_tests` is
// `Once`-guarded, so a test that omits it passes only while some
diff --git a/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs b/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs
index a7445cd13a..83d4beb7b1 100644
--- a/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs
@@ -43,6 +43,13 @@ impl HostAgentResolver for Host {
.unwrap();
definition.id = agent_id.to_string();
let builds = Arc::clone(&self.belt_builds);
+ let context = CoreContext::for_test(
+ DomainSet::full(),
+ Some(self.config.workspace_dir.clone()),
+ );
+ crate::agent::session_host::test_support::install_model_fixture_in(
+ context.extensions(),
+ );
Some(HostAgent {
definition,
config: self.config.clone(),
@@ -52,10 +59,7 @@ impl HostAgentResolver for Host {
crate::agent::HostTurnTools::advertised(vec![Box::new(Marker)])
})),
hooks: Default::default(),
- context: CoreContext::for_test(
- DomainSet::full(),
- Some(self.config.workspace_dir.clone()),
- ),
+ context,
})
}
}
@@ -121,6 +125,7 @@ fn an_id_the_host_does_not_know_falls_back_to_the_registries() {
let _slot = crate::agent::host_agents::tests::lock();
let tmp = TempDir::new().unwrap();
let config = config(&tmp);
+ crate::agent::session_host::test_support::install_model_fixture();
let installed: Arc<dyn HostAgentResolver> = Arc::new(Host {
config: config.clone(),
belt_builds: Arc::new(AtomicUsize::new(0)),