Skip to content

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

chore(tests): add coverage for mcp module client and cron policy failures

Steven Enamakeld694510e765d
diff --git a/crates/openhuman-core/src/mcp/module_client_tests.rs b/crates/openhuman-core/src/mcp/module_client_tests.rs
index 89b99aad51..645f2f5f3d 100644
--- a/crates/openhuman-core/src/mcp/module_client_tests.rs
+++ b/crates/openhuman-core/src/mcp/module_client_tests.rs
@@ -2,11 +2,13 @@ use super::*;
use std::sync::{Arc, Mutex};
use tokio::sync::Notify;
+type CallRecord = (String, String, Value, bool);
+
#[derive(Clone, Default)]
struct FakePort {
opened: Arc<Mutex<Vec<(String, McpClientConfig)>>>,
closed: Arc<Mutex<Vec<String>>>,
- calls: Arc<Mutex<Vec<(String, String, Value, bool)>>>,
+ calls: Arc<Mutex<Vec<CallRecord>>>,
prepared_requests: Arc<Mutex<Vec<PrepareAgentToolsRequest>>>,
validation_requests: Arc<Mutex<Vec<ValidateServerArgumentsRequest>>>,
transform_requests: Arc<Mutex<Vec<tinymcp_bus::TransformTextRequest>>>,
diff --git a/tests/support/cron_policy_failure.rs b/tests/support/cron_policy_failure.rs
index c9dbf19d40..8a4850ea29 100644
--- a/tests/support/cron_policy_failure.rs
+++ b/tests/support/cron_policy_failure.rs
@@ -408,14 +408,15 @@ pub(super) async fn policy_reads_refuse_execution_without_consuming_a_slot(case:
sqlite_before,
"configured storage fell back to SQLite"
);
- let reads = faults.calls.lock().unwrap();
- assert!(reads
- .iter()
- .any(|(scope, id)| scope == "profile:policy-alpha" && id == &job.id));
- assert!(reads
- .iter()
- .any(|(scope, id)| scope == "profile:policy-beta" && id == &job.id));
- drop(reads);
+ {
+ let reads = faults.calls.lock().unwrap();
+ assert!(reads
+ .iter()
+ .any(|(scope, id)| scope == "profile:policy-alpha" && id == &job.id));
+ assert!(reads
+ .iter()
+ .any(|(scope, id)| scope == "profile:policy-beta" && id == &job.id));
+ }
faults.read.store(false, Ordering::SeqCst);
CoreContext::scope(Arc::clone(&alpha), async {
policy::clear_policy(&config, &job.id).unwrap();
diff --git a/tests/tinysearch_module_e2e.rs b/tests/tinysearch_module_e2e.rs
index 209a9dba2a..6b69fa59b7 100644
--- a/tests/tinysearch_module_e2e.rs
+++ b/tests/tinysearch_module_e2e.rs
@@ -17,7 +17,7 @@ async fn pinned_search_module_serves_host_contract_and_rejects_disabled_executio
};
let info = host
.load_file_with_config(
- std::path::PathBuf::from(file),
+ file,
serde_json::to_value(config).unwrap(),
)
.expect("published artifact is admitted by the host loader");