Skip to content

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

feat(storage): add tests for artifact store and import state

Steven Enamakele52d0b0957c0
diff --git a/crates/openhuman-core/src/agent/artifacts/store_tests.rs b/crates/openhuman-core/src/agent/artifacts/store_tests.rs
index 48aa5e3711..9c04e81662 100644
--- a/crates/openhuman-core/src/agent/artifacts/store_tests.rs
+++ b/crates/openhuman-core/src/agent/artifacts/store_tests.rs
@@ -581,8 +581,10 @@ async fn regenerate_preserves_original_created_at() {
.await
.unwrap();
assert_eq!(second.id, id);
+ // Stored as epoch milliseconds, so compare at that precision.
assert_eq!(
- second.created_at, original_created,
+ second.created_at.timestamp_millis(),
+ original_created.timestamp_millis(),
"regenerate must preserve created_at, not bump it"
);
}
diff --git a/crates/openhuman-core/src/storage/import_state_tests.rs b/crates/openhuman-core/src/storage/import_state_tests.rs
index e7a41b8bdb..3843422472 100644
--- a/crates/openhuman-core/src/storage/import_state_tests.rs
+++ b/crates/openhuman-core/src/storage/import_state_tests.rs
@@ -183,11 +183,12 @@ fn a_legacy_marker_row_is_honoured_and_removed() {
assert_eq!(moved, 1);
assert!(done(&scoped, "storage", &step_id("storage_import", "approval@abcd")).await?);
assert!(!done(&scoped, "storage", &step_id("storage_import", "other@x")).await?);
- assert!(!docs
- .collections("")
- .await?
- .iter()
- .any(|name| name == "storage_import"));
+ assert!(
+ docs.query_all("storage_import", &tinystoragedrivers::Query::all())
+ .await
+ .map_or(true, |rows| rows.is_empty()),
+ "the marker rows are gone"
+ );
// A second sweep has nothing to do and keeps the entry.
assert_eq!(migrate_legacy_markers(&scoped).await?, 0);
assert!(done(&scoped, "storage", &step_id("storage_import", "approval@abcd")).await?);