Skip to content

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

test(storage): cover fence failing closed after lease store drop

Steven Enamakelcd5396e796e7
diff --git a/crates/openhuman-core/src/storage/fence_tests.rs b/crates/openhuman-core/src/storage/fence_tests.rs
index 03c2fecc34..fb1b3d137b 100644
--- a/crates/openhuman-core/src/storage/fence_tests.rs
+++ b/crates/openhuman-core/src/storage/fence_tests.rs
@@ -105,7 +105,7 @@ async fn a_released_or_missing_record_supersedes_the_fence() {
Err(FenceError::Superseded { stored: Some(1), .. })
));
- let other = LeaseFence::new(a, "nobody", "node-a", 1, u64::MAX, 0, scopes());
+ let other = LeaseFence::new(Arc::clone(&a), "nobody", "node-a", 1, u64::MAX, 0, scopes());
assert_eq!(
other.check(1).await,
Err(FenceError::Superseded {
@@ -113,6 +113,14 @@ async fn a_released_or_missing_record_supersedes_the_fence() {
stored: None
})
);
+
+ // A fence never keeps its node's lease store alive; once the store is
+ // gone, the check fails closed.
+ let orphan = LeaseFence::new(a, "alice", "node-a", 2, u64::MAX, 0, scopes());
+ assert!(matches!(
+ orphan.check(1).await,
+ Err(FenceError::Unverified(_))
+ ));
}
#[derive(Debug)]