Skip to content

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

fix(composio): give the module tests a memory backend, not SQLite

M3gA-Mindb3aee6651df7
diff --git a/crates/openhuman-core/src/integrations/composio/module_client.rs b/crates/openhuman-core/src/integrations/composio/module_client.rs
index 4057d33100..462400831a 100644
--- a/crates/openhuman-core/src/integrations/composio/module_client.rs
+++ b/crates/openhuman-core/src/integrations/composio/module_client.rs
@@ -317,7 +317,6 @@ pub(crate) struct ModuleGuard {
// Fields drop in order: the previous storage slot comes back before the
// next test may take the module.
_storage: crate::storage::test_support::InstalledBackendGuard,
- _directory: tempfile::TempDir,
_lock: tokio::sync::MutexGuard<'static, ()>,
}
@@ -325,20 +324,18 @@ pub(crate) struct ModuleGuard {
///
/// The module refuses a preference call when the host serves no storage, and
/// a module call carries no workspace for the host to fall back to, so the
-/// guard installs what a booted host has: a SQLite backend of its own,
-/// restored on drop.
+/// guard installs storage as a booted host has it (memory, the one driver
+/// every build has), restored on drop.
#[cfg(test)]
pub(crate) async fn module_guard() -> ModuleGuard {
// Tests that take the module drive its backend mode against a local mock;
// give this thread the stand-in route a host would register.
super::test_backend_route::register();
let lock = MODULE_LOCK.lock().await;
- let directory = tempfile::tempdir().unwrap();
- let url = format!("sqlite:{}", directory.path().join("storage").display());
- let backend = crate::storage::open(&url).await.unwrap();
ModuleGuard {
- _storage: crate::storage::test_support::install_for_test(&url, backend),
- _directory: directory,
+ _storage: crate::storage::test_support::install_backend_for_test(
+ crate::storage::test_support::memory_backend(),
+ ),
_lock: lock,
}
}
diff --git a/crates/openhuman-core/src/storage/test_support.rs b/crates/openhuman-core/src/storage/test_support.rs
index 9b35e2ffce..9ac69bf916 100644
--- a/crates/openhuman-core/src/storage/test_support.rs
+++ b/crates/openhuman-core/src/storage/test_support.rs
@@ -43,6 +43,19 @@ pub fn install_for_test(url: &str, backend: Arc<dyn StorageBackend>) -> Installe
}
}
+/// [`install_for_test`] for a backend opened from no URL (memory): a test
+/// that needs storage in the slot without exercising the boot path.
+pub fn install_backend_for_test(backend: Arc<dyn StorageBackend>) -> InstalledBackendGuard {
+ let slot_lock = lock_storage_slot();
+ let previous_url = crate::storage::installed_url();
+ let previous_backend = crate::storage::install(backend);
+ InstalledBackendGuard {
+ _slot_lock: slot_lock,
+ previous_backend,
+ previous_url,
+ }
+}
+
impl Drop for InstalledBackendGuard {
fn drop(&mut self) {
match (self.previous_backend.take(), self.previous_url.take()) {