Skip to content

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

test(storage): align test helpers with updated storage APIs

Steven Enamakelfe064e4c56cb
diff --git a/crates/openhuman-core/src/cron/documents_port_tests.rs b/crates/openhuman-core/src/cron/documents_port_tests.rs
index 77cc2b4391..35ee7a86fc 100644
--- a/crates/openhuman-core/src/cron/documents_port_tests.rs
+++ b/crates/openhuman-core/src/cron/documents_port_tests.rs
@@ -143,10 +143,11 @@ async fn schedule_store_migration_moves_legacy_jobs_runs_and_counter_before_read
);
}
assert_eq!(
- tinyflows_storage::Counters::new(docs)
- .next("cron", "runs")
+ docs.get("tsd.counters", "cron/runs")
.await
- .unwrap(),
+ .unwrap()
+ .expect("the imported counter remains readable")
+ .doc["next"],
8
);
for progress in [
diff --git a/crates/openhuman-core/src/storage/scope_move_tests.rs b/crates/openhuman-core/src/storage/scope_move_tests.rs
index b1cdbe7ce8..247309b3f7 100644
--- a/crates/openhuman-core/src/storage/scope_move_tests.rs
+++ b/crates/openhuman-core/src/storage/scope_move_tests.rs
@@ -223,7 +223,8 @@ async fn canonical_cluster_scope_import_converts_profiles_and_leases_in_place()
#[test]
fn boot_import_moves_profile_v1_scope_and_keeps_source_unchanged() {
use crate::storage::layout::{Target, legacy};
- use crate::storage::{self, CollectionSpec, DocumentStoreExt, Precondition, Query, Scope};
+ use crate::storage::{self, CollectionSpec, DocumentStoreExt, Precondition, Scope};
+ use tinystoragedrivers::Query;
let dir = tempfile::tempdir().unwrap();
let target = Target::new(dir.path(), "alice");
@@ -253,7 +254,7 @@ fn boot_import_moves_profile_v1_scope_and_keeps_source_unchanged() {
Precondition::Absent,
)
.await?;
- Ok::<_, anyhow::Error>(())
+ Ok::<_, crate::storage::StorageError>(())
})
.unwrap();
@@ -299,7 +300,7 @@ fn boot_import_moves_profile_v1_scope_and_keeps_source_unchanged() {
storage::block_on(async {
destination
.documents()
- .delete("scope_move_fixture", "stable-id", Precondition::Any)
+ .delete("scope_move_fixture", "stable-id", Precondition::None)
.await
})
.unwrap();
@@ -309,8 +310,8 @@ fn boot_import_moves_profile_v1_scope_and_keeps_source_unchanged() {
.find(|report| report.domain == IMPORT_DOMAIN)
.unwrap();
assert_eq!(
- outcome.outcome,
- Ok(crate::storage::import::Outcome::AlreadyDone)
+ outcome.outcome.unwrap(),
+ crate::storage::import::Outcome::AlreadyDone
);
let after = storage::block_on(async {
destination
@@ -340,8 +341,8 @@ fn boot_import_reports_no_source_for_a_workspace_without_legacy_storage() {
.find(|report| report.domain == IMPORT_DOMAIN)
.expect("scope migration is in the boot importer pipeline");
assert_eq!(
- report.outcome,
- Ok(crate::storage::import::Outcome::NoSource)
+ report.outcome.unwrap(),
+ crate::storage::import::Outcome::NoSource
);
}
diff --git a/crates/openhuman-core/src/storage/test_support.rs b/crates/openhuman-core/src/storage/test_support.rs
index c346da4a34..9b35e2ffce 100644
--- a/crates/openhuman-core/src/storage/test_support.rs
+++ b/crates/openhuman-core/src/storage/test_support.rs
@@ -91,7 +91,7 @@ pub fn sqlite_backend_in(
let url = url.into();
let backend = block_on_anyhow({
let url = url.clone();
- async move { crate::storage::open(&url).await }
+ async move { crate::storage::open(&url).await.map_err(Into::into) }
})?;
Ok(SqliteBackend {
_directory: directory,