Skip to content

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

test(mcp): install in-memory storage backend in audit and dispatch tests

Steven Enamakele0ee24fb16c5
diff --git a/crates/openhuman-core/src/mcp/audit/schemas_tests.rs b/crates/openhuman-core/src/mcp/audit/schemas_tests.rs
index 0994ace50c..b699524665 100644
--- a/crates/openhuman-core/src/mcp/audit/schemas_tests.rs
+++ b/crates/openhuman-core/src/mcp/audit/schemas_tests.rs
@@ -34,6 +34,9 @@ async fn handle_list_returns_persisted_audit_records() {
let config = config_rpc::load_config_with_timeout()
.await
.expect("config");
+ let _storage = crate::storage::test_support::install_backend_for_test(
+ crate::storage::test_support::memory_backend(),
+ );
crate::modules::ops::ensure_loaded(&config, "tinymcp")
.await
.expect("load the staged TinyMCP test module");
diff --git a/crates/openhuman-core/src/mcp/server/tools_tests_dispatch_tests.rs b/crates/openhuman-core/src/mcp/server/tools_tests_dispatch_tests.rs
index 744db4304f..f6d85d3c13 100644
--- a/crates/openhuman-core/src/mcp/server/tools_tests_dispatch_tests.rs
+++ b/crates/openhuman-core/src/mcp/server/tools_tests_dispatch_tests.rs
@@ -10,6 +10,9 @@ async fn call_tool_records_write_argument_rejection() {
let config = config_rpc::load_config_with_timeout()
.await
.expect("config");
+ let _storage = crate::storage::test_support::install_backend_for_test(
+ crate::storage::test_support::memory_backend(),
+ );
crate::modules::ops::ensure_loaded(&config, "tinymcp")
.await
.expect("load the staged TinyMCP test module");
@@ -87,6 +90,9 @@ async fn call_tool_validates_memory_arguments_before_dispatch() {
let config = config_rpc::load_config_with_timeout()
.await
.expect("config");
+ let _storage = crate::storage::test_support::install_backend_for_test(
+ crate::storage::test_support::memory_backend(),
+ );
crate::modules::ops::ensure_loaded(&config, "tinymcp")
.await
.expect("load the staged TinyMCP test module");
@@ -132,6 +138,9 @@ async fn call_tool_judges_the_policy_of_the_explicit_context_across_scopes() {
let mut allowing = crate::config::Config::default();
allowing.workspace_dir = tmp_allow.path().to_path_buf();
allowing.action_dir = tmp_allow.path().to_path_buf();
+ let _storage = crate::storage::test_support::install_backend_for_test(
+ crate::storage::test_support::memory_backend(),
+ );
crate::modules::ops::ensure_loaded(&allowing, "tinymcp")
.await
.expect("load the staged TinyMCP test module");
diff --git a/crates/openhuman-core/src/mcp/server/write_dispatch_tests.rs b/crates/openhuman-core/src/mcp/server/write_dispatch_tests.rs
index 63e86c4703..65e45b8850 100644
--- a/crates/openhuman-core/src/mcp/server/write_dispatch_tests.rs
+++ b/crates/openhuman-core/src/mcp/server/write_dispatch_tests.rs
@@ -59,6 +59,9 @@ async fn audit_write_rejection_records_failure_row() {
let mut config = Config::default();
config.workspace_dir = tmp.path().join("workspace");
std::fs::create_dir_all(&config.workspace_dir).unwrap();
+ let _storage = crate::storage::test_support::install_backend_for_test(
+ crate::storage::test_support::memory_backend(),
+ );
crate::modules::ops::ensure_loaded(&config, "tinymcp")
.await
.expect("load the staged TinyMCP test module");
@@ -162,6 +165,9 @@ async fn test_dispatch_write_tool_rpc_error_records_audit_and_returns_tool_error
let mut config = Config::default();
config.workspace_dir = tmp.path().join("workspace");
std::fs::create_dir_all(&config.workspace_dir).unwrap();
+ let _storage = crate::storage::test_support::install_backend_for_test(
+ crate::storage::test_support::memory_backend(),
+ );
crate::modules::ops::ensure_loaded(&config, "tinymcp")
.await
.expect("load the staged TinyMCP test module");
@@ -213,6 +219,9 @@ async fn test_audit_write_success_path() {
let mut config = Config::default();
config.workspace_dir = tmp.path().join("workspace");
std::fs::create_dir_all(&config.workspace_dir).unwrap();
+ let _storage = crate::storage::test_support::install_backend_for_test(
+ crate::storage::test_support::memory_backend(),
+ );
crate::modules::ops::ensure_loaded(&config, "tinymcp")
.await
.expect("load the staged TinyMCP test module");