Skip to content

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

test(profiles): exercise schema migrations against sqlite backend

Steven Enamakel7719f3824ad4
diff --git a/crates/openhuman-core/src/profiles/storage_schema_tests.rs b/crates/openhuman-core/src/profiles/storage_schema_tests.rs
index e0dc457e64..06fccf9804 100644
--- a/crates/openhuman-core/src/profiles/storage_schema_tests.rs
+++ b/crates/openhuman-core/src/profiles/storage_schema_tests.rs
@@ -1,6 +1,8 @@
use super::*;
use serde_json::json;
-use tinystoragedrivers::{MemoryStorage, Meta, Precondition, Scope, StorageBackend};
+use std::sync::Arc;
+use crate::storage::test_support::sqlite_backend;
+use tinystoragedrivers::{Meta, Precondition, Scope};
#[test]
fn a_registry_row_loses_its_seconds_field_and_keeps_its_creation_time() {
@@ -21,7 +23,8 @@ fn a_registry_row_loses_its_seconds_field_and_keeps_its_creation_time() {
#[tokio::test]
async fn migrate_cluster_moves_the_v1_registry_into_the_v2_collection() {
- let backend = MemoryStorage::new();
+ let fixture = sqlite_backend().unwrap();
+ let backend = Arc::clone(&fixture.backend);
let scoped = backend.for_scope(&Scope::cluster()).unwrap();
let docs = scoped.documents();
docs.ensure_collection(&CollectionSpec::new("profiles"))
@@ -51,13 +54,14 @@ async fn migrate_cluster_moves_the_v1_registry_into_the_v2_collection() {
#[test]
fn the_schema_composes_under_its_owner() {
- tinystoragedrivers::schema::Registry::compose([storage_schema()]).unwrap();
+ assert_eq!(collection_specs(), vec![CollectionSpec::new(REGISTRY_COLLECTION)]);
}
#[tokio::test]
async fn migrate_cluster_moves_v1_leases_into_tsd_leases_and_keeps_their_epoch() {
use crate::storage::lease::{DocumentLeases, LEASE_OWNER, LeaseStore};
- let backend = MemoryStorage::new();
+ let fixture = sqlite_backend().unwrap();
+ let backend = Arc::clone(&fixture.backend);
let scoped = backend.for_scope(&Scope::cluster()).unwrap();
let docs = scoped.documents();
docs.ensure_collection(&CollectionSpec::new("leases"))