Skip to content

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

style: reformat fence tests to satisfy rustfmt

Steven Enamakelf93291d3f12e
diff --git a/crates/openhuman-core/src/profiles/fence_tests.rs b/crates/openhuman-core/src/profiles/fence_tests.rs
index b160b7423d..6f4c5a227c 100644
--- a/crates/openhuman-core/src/profiles/fence_tests.rs
+++ b/crates/openhuman-core/src/profiles/fence_tests.rs
@@ -1,5 +1,4 @@
#![cfg(feature = "storage-sqlite")]
-
#![cfg(feature = "storage-sqlite")]
use super::*;
@@ -101,7 +100,9 @@ async fn a_takeover_fences_the_old_holders_writes_before_its_heartbeat_runs() {
a.provision(&alice).await.unwrap();
let state = a.open(&alice).await.unwrap();
write(&a_storage, "profile:alice").await.unwrap();
- write(&a_storage, "profile:alice/agent:default").await.unwrap();
+ write(&a_storage, "profile:alice/agent:default")
+ .await
+ .unwrap();
// Another node takes the profile over (by its clock the lease ran out).
let thief = DocumentLeases::cluster(
diff --git a/crates/openhuman-core/src/storage/fence_tests.rs b/crates/openhuman-core/src/storage/fence_tests.rs
index 6d1bfec6f8..a8a03e6763 100644
--- a/crates/openhuman-core/src/storage/fence_tests.rs
+++ b/crates/openhuman-core/src/storage/fence_tests.rs
@@ -1,8 +1,8 @@
#![cfg(feature = "storage-sqlite")]
use super::*;
-use crate::storage::test_support::SqliteBackend;
use crate::storage::lease::{DocumentLeases, LeaseError, LeaseGrant, LeaseRecord};
+use crate::storage::test_support::SqliteBackend;
use std::time::Duration;
const TTL: Duration = Duration::from_secs(30);
diff --git a/crates/openhuman-core/src/storage/fenced_backend_tests.rs b/crates/openhuman-core/src/storage/fenced_backend_tests.rs
index 5d2d8bbaaf..7c7a325775 100644
--- a/crates/openhuman-core/src/storage/fenced_backend_tests.rs
+++ b/crates/openhuman-core/src/storage/fenced_backend_tests.rs
@@ -8,8 +8,8 @@ use crate::storage::fence::{FenceError, LeaseFence, ScopeMatch};
use crate::storage::lease::{DocumentLeases, LeaseGrant, LeaseStore};
use serde_json::json;
use std::sync::{
- Arc,
atomic::{AtomicU64, Ordering},
+ Arc,
};
use std::time::Duration;
use tinystoragedrivers_api::StorageBackend as _;
@@ -114,14 +114,12 @@ async fn cached_handles_enforce_local_expiry_margin_and_accept_same_epoch_renewa
fence_error(&error),
Some(FenceError::Expired { .. })
));
- assert!(
- storage
- .documents()
- .get("items", "too-late")
- .await
- .unwrap()
- .is_none()
- );
+ assert!(storage
+ .documents()
+ .get("items", "too-late")
+ .await
+ .unwrap()
+ .is_none());
}
#[tokio::test]
@@ -165,21 +163,17 @@ async fn a_cached_handle_cannot_mutate_after_cross_process_takeover_on_any_port(
// A's local clock is deliberately behind. The local precheck succeeds;
// the driver's atomic condition is what refuses each cached-handle write.
a.set_now(base + 1_000);
- assert!(
- storage
- .documents()
- .put("items", "late", json!({}), Precondition::Absent)
- .await
- .is_err()
- );
+ assert!(storage
+ .documents()
+ .put("items", "late", json!({}), Precondition::Absent)
+ .await
+ .is_err());
assert!(storage.streams().append("events", json!(1)).await.is_err());
- assert!(
- storage
- .blobs()
- .put("blob", b"x".to_vec(), None)
- .await
- .is_err()
- );
+ assert!(storage
+ .blobs()
+ .put("blob", b"x".to_vec(), None)
+ .await
+ .is_err());
assert!(storage.kv().put("key", json!(1)).await.is_err());
assert!(storage.queues().ack("work", &receipt).await.is_err());
@@ -187,24 +181,22 @@ async fn a_cached_handle_cannot_mutate_after_cross_process_takeover_on_any_port(
.backend
.for_scope(&Scope::new("profile:alice").unwrap())
.unwrap();
- assert!(
- raw.documents()
- .get("items", "late")
- .await
- .unwrap()
- .is_none()
- );
+ assert!(raw
+ .documents()
+ .get("items", "late")
+ .await
+ .unwrap()
+ .is_none());
assert_eq!(raw.streams().len("events").await.unwrap(), 0);
assert!(raw.blobs().get("blob").await.unwrap().is_none());
assert!(raw.kv().get("key").await.unwrap().is_none());
assert_eq!(raw.queues().stats("work").await.unwrap().leased, 1);
- assert!(
- raw.documents()
- .get("items", "kept")
- .await
- .unwrap()
- .is_some()
- );
+ assert!(raw
+ .documents()
+ .get("items", "kept")
+ .await
+ .unwrap()
+ .is_some());
}
#[tokio::test]
@@ -219,24 +211,20 @@ async fn a_manually_latched_cached_fence_refuses_mutations_before_driver_io() {
.await
.unwrap();
fence.fence();
- assert!(
- storage
- .documents()
- .put("items", "late", json!({}), Precondition::Absent)
- .await
- .is_err()
- );
- assert!(
- shared
- .backend
- .for_scope(&Scope::new("profile:alice").unwrap())
- .unwrap()
- .documents()
- .get("items", "late")
- .await
- .unwrap()
- .is_none()
- );
+ assert!(storage
+ .documents()
+ .put("items", "late", json!({}), Precondition::Absent)
+ .await
+ .is_err());
+ assert!(shared
+ .backend
+ .for_scope(&Scope::new("profile:alice").unwrap())
+ .unwrap()
+ .documents()
+ .get("items", "late")
+ .await
+ .unwrap()
+ .is_none());
}
#[tokio::test]