Skip to content

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

test(storage): count v2 owner collections in desktop upgrade e2e

Steven Enamakel1e0a0e3cf134
diff --git a/tests/storage_desktop_upgrade_e2e.rs b/tests/storage_desktop_upgrade_e2e.rs
index b3f3c0f8aa..5ec448c475 100644
--- a/tests/storage_desktop_upgrade_e2e.rs
+++ b/tests/storage_desktop_upgrade_e2e.rs
@@ -401,10 +401,17 @@ async fn count(scoped: &ScopedStorage, collection: &str) -> usize {
async fn host_documents(backend: &dyn StorageBackend) -> usize {
let docs = backend.for_scope(&Scope::local()).unwrap();
let mut total = 0;
- for source in import::sources() {
- for spec in (source.collections)() {
- docs.documents().ensure_collection(&spec).await.unwrap();
- total += count(&docs, &spec.name).await;
+ // The importers write the v2 collections of the owners behind each source.
+ let owners: Vec<&str> = import::sources().iter().map(|source| source.owner).collect();
+ for schema in openhuman_core::storage::schema::owner_schemas() {
+ if !owners.contains(&schema.owner.as_str()) {
+ continue;
+ }
+ for item in &schema.items {
+ if let tinystoragedrivers::schema::Item::Collection { spec, .. } = item {
+ docs.documents().ensure_collection(spec).await.unwrap();
+ total += count(&docs, &spec.name).await;
+ }
}
}
total