Skip to content

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

test(tinyflows): add state tests for tinyflows

Steven Enamakele2981571e78d
diff --git a/crates/openhuman-core/src/flows/tinyflows/state_tests.rs b/crates/openhuman-core/src/flows/tinyflows/state_tests.rs
index 6735bbad88..9376b1b015 100644
--- a/crates/openhuman-core/src/flows/tinyflows/state_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/state_tests.rs
@@ -13,10 +13,6 @@ fn documents(namespace: &str) -> FlowState {
))
}
-fn sqlite(dir: &std::path::Path, namespace: &str) -> FlowState {
- FlowState::Sqlite(SqliteStateStore::new(dir, namespace))
-}
-
/// What a run stores through `StateStore` is what dedup settlement reads
/// through `DedupKv`, on both stores.
async fn engine_and_dedup_share_records(state: FlowState) {
@@ -34,15 +30,18 @@ async fn the_document_store_backs_both_views() {
}
#[tokio::test(flavor = "multi_thread")]
-async fn the_sqlite_store_backs_both_views() {
+async fn the_workspace_database_backs_both_views() {
let dir = tempfile::tempdir().unwrap();
- engine_and_dedup_share_records(sqlite(dir.path(), "flow:a")).await;
+ let config = Config {
+ workspace_dir: dir.path().to_path_buf(),
+ ..Config::default()
+ };
+ engine_and_dedup_share_records(FlowState::open(&config, "flow:a")).await;
}
#[tokio::test(flavor = "multi_thread")]
async fn namespaces_keep_flows_apart() {
- let dir = tempfile::tempdir().unwrap();
- let (a, b) = (sqlite(dir.path(), "flow:a"), sqlite(dir.path(), "flow:b"));
+ let (a, b) = (documents("flow:a"), documents("flow:b"));
a.store("k", json!(1)).await.unwrap();
assert_eq!(b.load("k").await.unwrap(), None);
}
@@ -59,7 +58,7 @@ async fn an_unresolved_scope_fails_every_call() {
}
#[test]
-fn without_a_backend_the_flow_state_is_sqlite() {
+fn without_a_backend_the_flow_state_is_on_the_workspace_database() {
let dir = tempfile::tempdir().unwrap();
let config = Config {
workspace_dir: dir.path().to_path_buf(),
@@ -69,6 +68,7 @@ fn without_a_backend_the_flow_state_is_sqlite() {
assert!(crate::storage::installed().is_none());
assert!(matches!(
FlowState::open(&config, "flow:a"),
- FlowState::Sqlite(_)
+ FlowState::Documents(_)
));
+ assert!(crate::flows::store::db_path(&config).is_file());
}