Skip to content

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

test: install sqlite storage backend in profile tests

Steven Enamakel254fe801add7
diff --git a/crates/openhuman-embed/tests/common/mod.rs b/crates/openhuman-embed/tests/common/mod.rs
index 36d7f518c5..bfe044f0b5 100644
--- a/crates/openhuman-embed/tests/common/mod.rs
+++ b/crates/openhuman-embed/tests/common/mod.rs
@@ -59,6 +59,18 @@ pub fn offline_config() -> Config {
config
}
+/// Install an isolated SQLite backend for tests that exercise atomic storage
+/// capabilities. The basic in-memory testkit intentionally advertises none.
+pub async fn install_sqlite_storage() -> tempfile::TempDir {
+ let directory = tempfile::tempdir().expect("SQLite storage directory");
+ let url = openhuman_core::storage::config::default_url(directory.path());
+ let backend = openhuman_core::storage::open(&url)
+ .await
+ .expect("SQLite test backend opens");
+ openhuman_core::storage::install(backend);
+ directory
+}
+
/// Serve the tinyflows module (scheduler runtime, job store, schedule maths)
/// from the test binary instead of a downloaded release. The factory goes in
/// through the core's `register_linked` seam and the module is resolved once,
diff --git a/crates/openhuman-embed/tests/profile_cron_sweep.rs b/crates/openhuman-embed/tests/profile_cron_sweep.rs
index d94bcc497a..42577af101 100644
--- a/crates/openhuman-embed/tests/profile_cron_sweep.rs
+++ b/crates/openhuman-embed/tests/profile_cron_sweep.rs
@@ -64,9 +64,7 @@ async fn scenario() {
.await;
PointedInference::install(&inference.uri());
// The shared backend every sweeper would contend on.
- openhuman_core::storage::install(Arc::new(
- tinystoragedrivers_testkit::MemoryBackend::new(),
- ));
+ let _storage = common::install_sqlite_storage().await;
let root = tempfile::tempdir().unwrap();
let recorder = Arc::new(Recorder::default());
diff --git a/crates/openhuman-embed/tests/profile_operator_tools.rs b/crates/openhuman-embed/tests/profile_operator_tools.rs
index 13e8c77c86..19e2cccf34 100644
--- a/crates/openhuman-embed/tests/profile_operator_tools.rs
+++ b/crates/openhuman-embed/tests/profile_operator_tools.rs
@@ -119,9 +119,7 @@ async fn scenario() {
.mount(&managed)
.await;
PointedInference::install(&managed.uri());
- openhuman_core::storage::install(Arc::new(
- tinystoragedrivers_testkit::MemoryBackend::new(),
- ));
+ let _storage = common::install_sqlite_storage().await;
let root = tempfile::tempdir().unwrap();
let recorder = Arc::new(Recorder::default());
diff --git a/crates/openhuman-embed/tests/profile_refused_tool_generation.rs b/crates/openhuman-embed/tests/profile_refused_tool_generation.rs
index 0032fbee3b..2301b5a7b6 100644
--- a/crates/openhuman-embed/tests/profile_refused_tool_generation.rs
+++ b/crates/openhuman-embed/tests/profile_refused_tool_generation.rs
@@ -105,9 +105,7 @@ async fn scenario() {
.mount(&managed)
.await;
PointedInference::install(&managed.uri());
- openhuman_core::storage::install(Arc::new(
- tinystoragedrivers_testkit::MemoryBackend::new(),
- ));
+ let _storage = common::install_sqlite_storage().await;
let root = tempfile::tempdir().unwrap();
let store = Arc::new(InMemorySessionStores::new());
diff --git a/crates/openhuman-embed/tests/profile_turn_serialization.rs b/crates/openhuman-embed/tests/profile_turn_serialization.rs
index fd1126d8e3..44ad72324b 100644
--- a/crates/openhuman-embed/tests/profile_turn_serialization.rs
+++ b/crates/openhuman-embed/tests/profile_turn_serialization.rs
@@ -83,9 +83,7 @@ async fn scenario() {
.mount(&inference)
.await;
PointedInference::install(&inference.uri());
- openhuman_core::storage::install(Arc::new(
- tinystoragedrivers_testkit::MemoryBackend::new(),
- ));
+ let _storage = common::install_sqlite_storage().await;
let root = tempfile::tempdir().unwrap();
let runtime = ProfileRuntime::builder(SaasConfig::new(root.path()))