Skip to content

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

test(storage): adapt rebind tests to fallible rebind

Steven Enamakelf37204965054
diff --git a/crates/openhuman-core/src/storage/rebind_tests.rs b/crates/openhuman-core/src/storage/rebind_tests.rs
index 9b4820796a..0b82cfbc1d 100644
--- a/crates/openhuman-core/src/storage/rebind_tests.rs
+++ b/crates/openhuman-core/src/storage/rebind_tests.rs
@@ -209,7 +209,10 @@ fn a_session_store_rebind_failure_keeps_the_previous_backend_installed() {
);
assert!(error.is_err());
- assert!(installed.urls().is_empty(), "the new backend was not installed");
+ assert!(
+ installed.urls().is_empty(),
+ "the new backend was not installed"
+ );
}
#[test]
diff --git a/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rs b/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rs
index c0b6ad4628..368b2445cc 100644
--- a/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rs
+++ b/crates/openhuman-core/src/storage/sessions/tenant_router_tests.rs
@@ -132,7 +132,7 @@ fn upstream_rebind_keeps_tenant_routing_and_moves_only_future_leases() {
"profiles keep separate scopes"
);
- assert_eq!(registry.rebind(&second), 2);
+ assert_eq!(registry.rebind(&second).unwrap(), 2);
assert!(
Arc::ptr_eq(&*router.backend.read().unwrap(), &second),
"new tenants open on the newly bound workspace backend"
@@ -201,7 +201,7 @@ fn failed_rebind_rolls_back_tenant_providers_already_moved() {
.destination_key()
.is_some_and(|key| key.starts_with("original://")));
- assert_eq!(registry.rebind(&second), 0);
+ assert!(registry.rebind(&second).is_err());
assert!(Arc::ptr_eq(&*router.backend.read().unwrap(), &first));
assert!(
@@ -252,6 +252,13 @@ impl StorageBackend for MarkerStorage {
if self.reject_bob && scope.as_str().starts_with("u:bob/") {
return Err(StorageError::invalid_input("injected Bob tenant failure"));
}
- self.inner.for_scope(scope)
+ let scoped = self.inner.for_scope(scope)?;
+ Ok(ScopedStorage::new(
+ scope.clone(),
+ self.driver,
+ Arc::clone(scoped.documents()),
+ Arc::clone(scoped.streams()),
+ Arc::clone(scoped.blobs()),
+ ))
}
}