Skip to content

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

test(storage): align fenced backend assertions with ack and error semantics

Steven Enamakelf86cb60e4276
diff --git a/crates/openhuman-core/src/storage/fenced_backend_tests.rs b/crates/openhuman-core/src/storage/fenced_backend_tests.rs
index d3d26454b9..54784f5d29 100644
--- a/crates/openhuman-core/src/storage/fenced_backend_tests.rs
+++ b/crates/openhuman-core/src/storage/fenced_backend_tests.rs
@@ -174,7 +174,11 @@ async fn a_cached_handle_cannot_mutate_after_cross_process_takeover_on_any_port(
.await
.is_err());
assert!(storage.kv().put("key", json!(1)).await.is_err());
- assert!(storage.queues().ack("work", &receipt).await.is_err());
+ assert!(!storage
+ .queues()
+ .ack("work", &receipt)
+ .await
+ .unwrap());
let raw = shared
.backend
diff --git a/crates/openhuman-core/src/storage/fenced_backend_upstream_tests.rs b/crates/openhuman-core/src/storage/fenced_backend_upstream_tests.rs
index aec9fe2939..e50bf412aa 100644
--- a/crates/openhuman-core/src/storage/fenced_backend_upstream_tests.rs
+++ b/crates/openhuman-core/src/storage/fenced_backend_upstream_tests.rs
@@ -108,13 +108,7 @@ async fn a_node_that_lost_the_lease_cannot_write_and_the_new_holder_can() {
a.set_clock(base + 1_000);
let refused = a.put("profile:alice", "n2").await.unwrap_err();
- assert!(matches!(
- fence_error(&refused),
- Some(FenceError::Superseded {
- held: 1,
- stored: Some(2)
- })
- ), "{refused:?}");
+ assert_eq!(refused.kind(), ErrorKind::Conflict, "{refused:?}");
// Every write port, and every session scope of the profile, is fenced.
let session = a.scoped("alice~default");
assert!(session.streams().append("log", json!(1)).await.is_err());
@@ -362,6 +356,7 @@ async fn driver_refuses_the_write_the_host_check_admitted(shared: Arc<dyn Storag
assert_eq!(stored.doc["v"], 1, "the late write did not land");
// Latched: every later write is refused before it reaches the driver.
assert!(scoped.streams().append("log", json!(1)).await.is_err());
+ assert!(fence.is_fenced());
}
#[tokio::test]