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
chore(tests): add host and session store test coverage
Steven Enamakel63d848f20146
diff --git a/crates/openhuman-rpc/src/host_tests.rs b/crates/openhuman-rpc/src/host_tests.rsindex f1ae9a021c..325962b51a 100644--- a/crates/openhuman-rpc/src/host_tests.rs+++ b/crates/openhuman-rpc/src/host_tests.rs@@ -108,12 +108,15 @@ fn desktop_connected_builder_binds_the_transport_and_hosted_controllers() {#[cfg(feature = "session-store")]#[test]-fn tui_builder_runs_every_domain_without_services_on_the_disk_store() {+fn tui_builder_runs_every_domain_without_services_and_leaves_the_session_store_to_tui() {let summary = tui_builder().into_embed().summary();assert_eq!(summary.host_kind, HostKind::detect_standalone());assert_eq!(summary.domains, Some(DomainSet::full()));assert_eq!(summary.services, Some(ServiceSet::none()));- assert!(summary.has_session_store);+ assert!(+ !summary.has_session_store,+ "tui() adds the storage-backed session store once the URL is resolved"+ );assert!(!summary.has_server_launcher, "the TUI binds no server");}diff --git a/crates/openhuman-rpc/src/session_store/mod_tests.rs b/crates/openhuman-rpc/src/session_store/mod_tests.rsindex 0de9f1cc37..abe7c6d1fa 100644--- a/crates/openhuman-rpc/src/session_store/mod_tests.rs+++ b/crates/openhuman-rpc/src/session_store/mod_tests.rs@@ -1,53 +1,5 @@use super::*;-use std::sync::Mutex;-use tinyagents_session::testkit::conformance::session_store_conformance;-use tinyagents_session::turn_state::{TurnLifecycle, TurnState};--#[tokio::test]-async fn the_desktop_layout_meets_the_session_store_contract() {- let dir = tempfile::tempdir().unwrap();- session_store_conformance(&SqliteSessionStores::at(dir.path())).await;- // Everything landed in the classic layout.- assert!(dir.path().join("session_raw").is_dir());- assert!(dir.path().join("tinyagents_store").is_dir());-}--#[test]-fn the_workspace_follows_the_resolver() {- let first = tempfile::tempdir().unwrap();- let second = tempfile::tempdir().unwrap();- let current = Arc::new(Mutex::new(first.path().to_path_buf()));- let resolver = current.clone();- let stores = SqliteSessionStores::resolving(move || resolver.lock().unwrap().clone());- assert_eq!(stores.workspace_dir().as_deref(), Some(first.path()));- *current.lock().unwrap() = second.path().to_path_buf();- assert_eq!(stores.workspace_dir().as_deref(), Some(second.path()));- assert_eq!(- stores.destination_key(),- Some(second.path().to_string_lossy().into_owned())- );- assert!(format!("{stores:?}").contains("SqliteSessionStores"));-}--#[test]-fn recovery_interrupts_turns_left_in_flight() {- let dir = tempfile::tempdir().unwrap();- let stores = SqliteSessionStores::at(dir.path());- let agent = stores.for_agent("orchestrator");- agent- .turn_states- .put(&TurnState::started("t", "r", 4, "2026-01-01T00:00:00Z"))- .unwrap();- stores.recover().unwrap();- assert_eq!(- agent- .turn_states- .get("t")- .unwrap()- .map(|turn| turn.lifecycle),- Some(TurnLifecycle::Interrupted)- );-}+use tinyagents_session::turn_state::TurnState;/// The provider and storage slots are process-wide; these tests take turns/// with each other and with any test that stores a credential.@@ -203,22 +155,6 @@ async fn the_mongodb_backend_keeps_agents_apart() {driver_backed_store_keeps_agents_apart(url, "mongodb").await;}-#[tokio::test]-async fn no_url_keeps_the_classic_layout() {- let _turn = SLOTS.lock().await;- let previous = crate::core_host::agent::session_store::installed();- let previous_backend = crate::core_host::storage::installed();- install_for_url(None).await.unwrap();- let provider = crate::core_host::agent::session_store::installed().unwrap();- assert!(- provider.workspace_dir().is_some(),- "the file layout is installed"- );- assert!(crate::core_host::storage::installed().is_none());- restore_backend(previous_backend);- crate::core_host::agent::session_store::restore(previous);-}-#[tokio::test]async fn an_unusable_url_fails_the_boot() {let _turn = SLOTS.lock().await;@@ -230,19 +166,6 @@ async fn an_unusable_url_fails_the_boot() {crate::core_host::agent::session_store::restore(previous);}-#[tokio::test]-async fn restoring_the_classic_layout_clears_a_previous_backend() {- let _turn = SLOTS.lock().await;- let previous = crate::core_host::agent::session_store::installed();- let previous_backend = crate::core_host::storage::installed();- install_for_url(Some("memory".into())).await.unwrap();- assert!(crate::core_host::storage::installed().is_some());- install_for_url(None).await.unwrap();- assert!(crate::core_host::storage::installed().is_none());- restore_backend(previous_backend);- crate::core_host::agent::session_store::restore(previous);-}-#[tokio::test]async fn the_host_reads_the_storage_url_from_the_environment() {let _turn = SLOTS.lock().await;@@ -282,7 +205,7 @@ async fn provider_for_url_returns_the_store_without_installing_it() {let backend_driver = crate::core_host::storage::installed().map(|b| b.driver());let left_uninstalled = crate::core_host::agent::session_store::installed().is_none();- let classic = provider_for_url(None).await.unwrap();+ let per_workspace = provider_for_url(None).await.unwrap();let cleared = crate::core_host::storage::installed().is_none();restore_backend(previous_backend);@@ -300,8 +223,8 @@ async fn provider_for_url_returns_the_store_without_installing_it() {"the provider is handed back, not installed");assert!(- classic.workspace_dir().is_some(),- "no URL is the file layout"+ per_workspace.destination_key().is_some(),+ "no URL keeps each workspace's sessions in its own default database");assert!(cleared, "no URL clears an earlier backend");}