Skip to content

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

test(storage): assert fenced writes report superseded

Steven Enamakeld220a68a22ae
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 b91854c1fa..551439d2b7 100644
--- a/crates/openhuman-core/src/storage/fenced_backend_upstream_tests.rs
+++ b/crates/openhuman-core/src/storage/fenced_backend_upstream_tests.rs
@@ -108,7 +108,10 @@ 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_eq!(refused.kind(), ErrorKind::Conflict, "{refused:?}");
+ assert!(matches!(
+ fence_error(&refused),
+ Some(FenceError::Superseded { .. })
+ ));
// 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());
@@ -340,7 +343,10 @@ async fn driver_refuses_the_write_the_host_check_admitted(shared: Arc<dyn Storag
.put("notes", "n1", json!({"v": 2}), Precondition::None)
.await
.unwrap_err();
- assert_eq!(refused.kind(), ErrorKind::Conflict, "{refused:?}");
+ assert!(matches!(
+ fence_error(&refused),
+ Some(FenceError::Superseded { .. })
+ ));
let stored = shared
.for_scope(&Scope::new("profile:alice").unwrap())
.unwrap()