The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(storage): route tests through shared backend helpers
Steven Enamakel93c28c7f6e7b
diff --git a/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod_tests.rs b/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod_tests.rsindex 7854784434..9dd1fdc770 100644--- a/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod_tests.rs+++ b/crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod_tests.rs@@ -95,9 +95,9 @@ async fn a_wrapped_read_is_pointed_at_the_materialised_file() {/// from this tenant's store, so its key is never served or materialised.#[tokio::test]async fn artifacts_are_tenant_scoped() {- use tinystoragedrivers::{MemoryStorage, Scope, StorageBackend};+ use crate::storage::{test_support::memory_backend, Scope};let tmp = tempfile::tempdir().unwrap();- let backend = MemoryStorage::new();+ let backend = memory_backend();let scoped = |name: &str| {let scope = Scope::new(name).unwrap();Arc::clone(backend.for_scope(&scope).unwrap().blobs())diff --git a/crates/openhuman-core/src/storage/documents_tests.rs b/crates/openhuman-core/src/storage/documents_tests.rsindex 7d3857565c..16995ea1ff 100644--- a/crates/openhuman-core/src/storage/documents_tests.rs+++ b/crates/openhuman-core/src/storage/documents_tests.rs@@ -2,7 +2,7 @@ use super::*;use serde_json::json;use tinystoragedrivers::{IndexSpec, Precondition};-use crate::storage::{MemoryStorage, Scope, StorageBackend};+use crate::storage::{test_support::memory_backend, Scope, StorageBackend};const THINGS: &str = "things";@@ -10,14 +10,14 @@ fn specs() -> Vec<CollectionSpec> {vec![CollectionSpec::new(THINGS).index(IndexSpec::new("by_state", ["state"]))]}-fn repo(storage: &MemoryStorage, scope: &str) -> Repo {+fn repo(storage: &dyn StorageBackend, scope: &str) -> Repo {let scoped = storage.for_scope(&Scope::new(scope).unwrap()).unwrap();Repo::over(&scoped, "test", specs)}#[test]fn run_declares_the_collections_and_returns_the_result() {- let storage = MemoryStorage::new();+ let storage = memory_backend();let repo = repo(&storage, "local");repo.run(|docs| async move {docs.put(@@ -39,7 +39,7 @@ fn run_declares_the_collections_and_returns_the_result() {#[test]fn storage_errors_name_the_domain() {- let storage = MemoryStorage::new();+ let storage = memory_backend();let error = repo(&storage, "local").run(|_| async { Err::<(), _>(StorageError::conflict("raced")) }).unwrap_err();@@ -48,7 +48,7 @@ fn storage_errors_name_the_domain() {#[test]fn compare_and_swap_applies_declines_and_skips_missing() {- let storage = MemoryStorage::new();+ let storage = memory_backend();let repo = repo(&storage, "local");let (closed, declined, missing) = repo.run(|docs| async move {@@ -78,7 +78,7 @@ fn compare_and_swap_applies_declines_and_skips_missing() {#[test]fn concurrent_swaps_apply_once() {- let storage = MemoryStorage::new();+ let storage = memory_backend();let repo = repo(&storage, "local");repo.run(|docs| async move {docs.put(@@ -114,7 +114,7 @@ fn concurrent_swaps_apply_once() {#[test]fn scopes_do_not_see_each_other() {- let storage = MemoryStorage::new();+ let storage = memory_backend();repo(&storage, "alice").run(|docs| async move {docs.put(THINGS, "a", json!({}), Precondition::Absent)@@ -129,7 +129,7 @@ fn scopes_do_not_see_each_other() {}fn backend() -> Arc<dyn StorageBackend> {- Arc::new(MemoryStorage::new())+ memory_backend()}#[test]diff --git a/crates/openhuman-core/src/storage/fence_tests.rs b/crates/openhuman-core/src/storage/fence_tests.rsindex f630a54e02..6d1bfec6f8 100644--- a/crates/openhuman-core/src/storage/fence_tests.rs+++ b/crates/openhuman-core/src/storage/fence_tests.rs@@ -280,7 +280,7 @@ fn registration_preserves_a_live_or_unanchored_higher_epoch_fence() {#[tokio::test]async fn the_guard_passes_unfenced_scopes_and_refuses_with_a_typed_error() {- let backend = MemoryStorage::new();+ let backend = crate::storage::test_support::sqlite_backend().unwrap();let store = leases(&backend, "a");let grant = store.acquire("alice", 0).await.unwrap();let registry = FenceRegistry::new(|| 40_000);