Skip to content

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

chore(tests): add storage import and skill catalog store tests

Steven Enamakel2ab792365474
diff --git a/crates/openhuman-core/src/modules/storage_import_tinyjuice_tests.rs b/crates/openhuman-core/src/modules/storage_import_tinyjuice_tests.rs
index 5df28a0036..9933afe603 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinyjuice_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinyjuice_tests.rs
@@ -79,27 +79,6 @@ async fn originals_within_their_ttl_move_into_the_modules_blobs() {
);
}
-#[tokio::test]
-async fn an_imported_original_expires_with_the_time_it_had_left() {
- let legacy = legacy_root();
- let scoped = scoped();
- import_into(
- &scoped,
- legacy.path(),
- Some(Duration::from_secs(3600)),
- SystemTime::now(),
- )
- .await
- .unwrap();
- let meta = scoped
- .blobs()
- .head(&format!("{CCR_BLOB_PREFIX}{FRESH}"))
- .await
- .unwrap()
- .expect("imported");
- assert!(meta.expires_at.is_some(), "a TTL carries over as an expiry");
-}
-
#[tokio::test]
async fn without_a_ttl_every_readable_original_is_kept() {
let legacy = legacy_root();
diff --git a/crates/openhuman-core/src/skills/catalog/store_tests.rs b/crates/openhuman-core/src/skills/catalog/store_tests.rs
index b2a304f521..5edacbafba 100644
--- a/crates/openhuman-core/src/skills/catalog/store_tests.rs
+++ b/crates/openhuman-core/src/skills/catalog/store_tests.rs
@@ -1,10 +1,20 @@
use super::*;
-use tinyskills::{FileCatalogStore, Validators};
+use tinyskills::Validators;
fn catalog(fetched_at: u64) -> StoredCatalog {
StoredCatalog::new(Vec::new(), fetched_at, Validators::default(), 0)
}
+/// Writes `<dir>/<registry>.json` the way tinyskills' removed
+/// `FileCatalogStore` did: the serialized [`StoredCatalog`].
+fn write_legacy(dir: &Path, registry: &str, catalog: &StoredCatalog) {
+ std::fs::write(
+ dir.join(format!("{registry}.json")),
+ serde_json::to_vec(catalog).unwrap(),
+ )
+ .unwrap();
+}
+
#[tokio::test]
async fn a_saved_catalog_is_read_back_without_writing_a_catalog_file() {
let tmp = tempfile::tempdir().unwrap();
@@ -24,10 +34,7 @@ async fn a_saved_catalog_is_read_back_without_writing_a_catalog_file() {
#[tokio::test]
async fn a_legacy_catalog_file_is_imported_once_and_left_in_place() {
let tmp = tempfile::tempdir().unwrap();
- FileCatalogStore::new(tmp.path())
- .save("hermes", &catalog(11))
- .await
- .unwrap();
+ write_legacy(tmp.path(), "hermes", &catalog(11));
let legacy = tmp.path().join("hermes.json");
let before = std::fs::read(&legacy).unwrap();
let store = HostCatalogStore::new(tmp.path());
@@ -62,10 +69,7 @@ async fn an_unusable_legacy_file_reads_as_an_empty_cache() {
async fn a_symlinked_legacy_file_is_not_followed() {
let tmp = tempfile::tempdir().unwrap();
let elsewhere = tempfile::tempdir().unwrap();
- FileCatalogStore::new(elsewhere.path())
- .save("hermes", &catalog(5))
- .await
- .unwrap();
+ write_legacy(elsewhere.path(), "hermes", &catalog(5));
std::os::unix::fs::symlink(
elsewhere.path().join("hermes.json"),
tmp.path().join("hermes.json"),