Skip to content

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

test(storage): await endpoint setup and use document_id in calls

Steven Enamakeld1b7fcd55d92
diff --git a/crates/openhuman-core/src/modules/storage_host_invocation_tests.rs b/crates/openhuman-core/src/modules/storage_host_invocation_tests.rs
index 7cf24397a7..c5b8fd534c 100644
--- a/crates/openhuman-core/src/modules/storage_host_invocation_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_host_invocation_tests.rs
@@ -1,10 +1,15 @@
use super::*;
use tinystoragedrivers_busproxy::{Object, StorageCall};
-fn endpoint() -> (DocumentsOnlyEndpoint, BusName) {
+async fn endpoint() -> (DocumentsOnlyEndpoint, BusName) {
let backend = crate::storage::test_support::memory_backend();
let scope = crate::storage::Scope::new("local").unwrap();
let storage = backend.for_scope(&scope).unwrap();
+ storage
+ .documents()
+ .ensure_collection(&crate::storage::CollectionSpec::new("juice.savings"))
+ .await
+ .unwrap();
let expected_peer = BusName::new(":1.7").unwrap();
(
DocumentsOnlyEndpoint {
@@ -41,7 +46,7 @@ async fn call(
#[tokio::test]
async fn callback_authenticates_before_metadata_and_restricts_ports() {
- let (endpoint, peer) = endpoint();
+ let (endpoint, peer) = endpoint().await;
let attacker = BusName::new(":1.8").unwrap();
assert_eq!(
@@ -96,14 +101,14 @@ async fn callback_authenticates_before_metadata_and_restricts_ports() {
#[tokio::test]
async fn callback_documents_route_uses_the_captured_storage() {
- let (endpoint, peer) = endpoint();
+ let (endpoint, peer) = endpoint().await;
let result = call(
&endpoint,
Some(&peer),
Object::Documents,
"Get",
- json!({"collection": "juice.savings", "id": "current"}),
+ json!({"collection": "juice.savings", "document_id": "current"}),
)
.await;
@@ -117,7 +122,7 @@ async fn callback_documents_route_uses_the_captured_storage() {
#[tokio::test]
async fn callback_documents_route_keeps_the_module_collection_grant() {
- let (endpoint, peer) = endpoint();
+ let (endpoint, peer) = endpoint().await;
assert_eq!(
call(
@@ -125,7 +130,7 @@ async fn callback_documents_route_keeps_the_module_collection_grant() {
Some(&peer),
Object::Documents,
"Get",
- json!({"collection": "another.module.collection", "id": "x"}),
+ json!({"collection": "another.module.collection", "document_id": "x"}),
)
.await,
Err(HostFailure::Denied("target-not-granted"))
@@ -134,7 +139,7 @@ async fn callback_documents_route_keeps_the_module_collection_grant() {
#[tokio::test]
async fn callback_documents_route_does_not_advertise_or_open_unrelayed_watches() {
- let (endpoint, peer) = endpoint();
+ let (endpoint, peer) = endpoint().await;
let capabilities = call(
&endpoint,
@@ -169,7 +174,7 @@ async fn callback_documents_route_does_not_advertise_or_open_unrelayed_watches()
#[tokio::test]
async fn dropped_invocation_refuses_calls_already_in_flight_at_endpoint() {
- let (endpoint, peer) = endpoint();
+ let (endpoint, peer) = endpoint().await;
endpoint.active.store(false, Ordering::Release);
assert_eq!(