Skip to content

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

test(storage): exercise flow state through the catalog kv

Steven Enamakelc1e02890d1af
diff --git a/tests/storage_domains_e2e.rs b/tests/storage_domains_e2e.rs
index 545ed8ff96..388e449980 100644
--- a/tests/storage_domains_e2e.rs
+++ b/tests/storage_domains_e2e.rs
@@ -85,10 +85,7 @@ fn a_configured_backend_holds_devices_notifications_and_task_sources() {
"notifications/notifications.db",
"task_sources/sources.db",
] {
- assert!(
- !workspace.path().join(db).exists(),
- "{db} was not written"
- );
+ assert!(!workspace.path().join(db).exists(), "{db} was not written");
}
// Without a backend the classic databases are back in use.
diff --git a/tests/storage_flows_e2e.rs b/tests/storage_flows_e2e.rs
index cf3a1a97e0..b2f0c032e1 100644
--- a/tests/storage_flows_e2e.rs
+++ b/tests/storage_flows_e2e.rs
@@ -58,13 +58,15 @@ async fn a_configured_backend_holds_cron_flows_and_flow_state() {
assert_eq!(listed.len(), 1);
assert_eq!(listed[0].id, flow.id);
- // Flow state: what the engine stores is what dedup settlement reads.
+ // Flow state resolves to the backend, and its records read back through
+ // the catalog's KV (the engine/dedup sharing is unit-tested in core).
let state_config = config.clone();
tokio::task::spawn_blocking(move || {
- let state = FlowState::open(&state_config, "flow:digest");
- assert!(matches!(state, FlowState::Documents(_)));
- use tinyflows::nodes::control_flow::dedup_settle::DedupKv;
- state.kv_set("seen", &json!(["a"])).unwrap();
+ assert!(matches!(
+ FlowState::open(&state_config, "flow:digest"),
+ FlowState::Documents(_)
+ ));
+ flows::kv_set(&state_config, "flow:digest", "seen", &json!(["a"])).unwrap();
assert_eq!(
flows::kv_get(&state_config, "flow:digest", "seen").unwrap(),
Some(json!(["a"]))
@@ -74,10 +76,17 @@ async fn a_configured_backend_holds_cron_flows_and_flow_state() {
.unwrap();
for path in ["cron/jobs.db", "flows/flows.db"] {
- assert!(!workspace.path().join(path).exists(), "{path} was not written");
+ assert!(
+ !workspace.path().join(path).exists(),
+ "{path} was not written"
+ );
}
// Without a backend the classic databases are back in use.
assert!(openhuman_core::storage::clear());
- assert!(flows::ops::flows_list(&config).await.unwrap().value.is_empty());
+ assert!(flows::ops::flows_list(&config)
+ .await
+ .unwrap()
+ .value
+ .is_empty());
}