Skip to content

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

test(mcp): install sqlite backend for dispatch argument validation tests

Steven Enamakeld86335f6af2a
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 d3e2376311..6b9e86da2c 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
@@ -1,5 +1,39 @@
use super::*;
+/// Points the ambient workspace at a SQLite test backend: validating tool
+/// arguments calls the tinymcp module, which reaches the host's installed
+/// storage, and the in-memory workspace default cannot serve it.
+struct AmbientStorage {
+ _fixture: crate::storage::test_support::SqliteBackend,
+ _guard: crate::storage::test_support::InstalledBackendGuard,
+}
+
+impl AmbientStorage {
+ fn install() -> Self {
+ let fixture =
+ crate::storage::test_support::sqlite_backend().expect("SQLite test backend");
+ let guard = crate::storage::test_support::install_for_test(
+ &fixture.url,
+ std::sync::Arc::clone(&fixture.backend),
+ );
+ unsafe {
+ std::env::set_var(crate::storage::STORAGE_URL_VAR, &fixture.url);
+ }
+ Self {
+ _fixture: fixture,
+ _guard: guard,
+ }
+ }
+}
+
+impl Drop for AmbientStorage {
+ fn drop(&mut self) {
+ unsafe {
+ std::env::remove_var(crate::storage::STORAGE_URL_VAR);
+ }
+ }
+}
+
#[tokio::test]
async fn call_tool_records_write_argument_rejection() {
let _env_lock = crate::config::TEST_ENV_LOCK.lock().await;
@@ -7,6 +41,7 @@ async fn call_tool_records_write_argument_rejection() {
unsafe {
std::env::set_var("OPENHUMAN_WORKSPACE", tmp.path());
}
+ let _storage = AmbientStorage::install();
let config = config_rpc::load_config_with_timeout()
.await
.expect("config");
@@ -81,6 +116,7 @@ async fn call_tool_validates_memory_arguments_before_dispatch() {
unsafe {
std::env::set_var("OPENHUMAN_WORKSPACE", tmp.path());
}
+ let _storage = AmbientStorage::install();
let err = call_tool(
&crate::core::runtime::DispatchCtx::ambient(),
"memory.forget",