Skip to content

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

refactor(tests): update storage driver imports in tinyconnectors tests

Steven Enamakel833a91b0ae3c
diff --git a/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs b/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs
index 96dc6c0a4c..d00cb7e614 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs
@@ -1,11 +1,10 @@
use super::*;
use sha2::Digest;
-use tinystoragedrivers::{MemoryStorage, Precondition, Scope, StorageBackend};
+use crate::storage::{Precondition, Scope, Storage};
+use tinystoragedrivers_testkit::memory_storage;
-fn scoped() -> ScopedStorage {
- MemoryStorage::new()
- .for_scope(&Scope::new("module:tinyconnectors@local").unwrap())
- .unwrap()
+fn scoped() -> Storage {
+ memory_storage(&Scope::new("module:tinyconnectors@local").unwrap())
}
/// A state directory as the pre-storage module left it.
diff --git a/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings_tests.rs b/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings_tests.rs
index 9a44158721..6bebff0093 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings_tests.rs
@@ -1,6 +1,7 @@
use super::*;
use std::sync::atomic::{AtomicUsize, Ordering};
-use tinystoragedrivers::{MemoryStorage, Scope, StorageBackend};
+use crate::storage::{Scope, Storage};
+use tinystoragedrivers_testkit::memory_storage;
const SNAPSHOT: &str = r#"{
"total":{"events":2,"originalTokens":4000,"compactedTokens":2000,"tokensSaved":2000,"costSavedUsd":0.006},
@@ -8,10 +9,8 @@ const SNAPSHOT: &str = r#"{
"byCompressor":{"smartcrusher":{"events":2,"originalTokens":4000,"compactedTokens":2000,"tokensSaved":2000,"costSavedUsd":0.006}}
}"#;
-fn scoped() -> ScopedStorage {
- MemoryStorage::new()
- .for_scope(&Scope::new("module:tinyjuice@local").unwrap())
- .unwrap()
+fn scoped() -> Storage {
+ memory_storage(&Scope::new("module:tinyjuice@local").unwrap())
}
fn workspace_with(snapshot: Option<&str>) -> tempfile::TempDir {
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 9302591773..1c0a24432b 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinyjuice_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinyjuice_tests.rs
@@ -1,15 +1,14 @@
use super::*;
use std::time::Duration;
-use tinystoragedrivers::{MemoryStorage, Scope, StorageBackend};
+use crate::storage::{Scope, Storage};
+use tinystoragedrivers_testkit::memory_storage;
const FRESH: &str = "00112233445566778899aabbccddeeff";
const OLD: &str = "ffeeddccbbaa99887766554433221100";
const UPPER: &str = "ABCDEF0123456789ABCDEF0123456789";
-fn scoped() -> ScopedStorage {
- MemoryStorage::new()
- .for_scope(&Scope::new("module:tinyjuice@local").unwrap())
- .unwrap()
+fn scoped() -> Storage {
+ memory_storage(&Scope::new("module:tinyjuice@local").unwrap())
}
fn set_age(path: &Path, age: Duration) {
@@ -36,7 +35,7 @@ fn legacy_root() -> tempfile::TempDir {
dir
}
-async fn read(scoped: &ScopedStorage, token: &str) -> Option<String> {
+async fn read(scoped: &Storage, token: &str) -> Option<String> {
scoped
.blobs()
.get(&format!("{CCR_BLOB_PREFIX}{token}"))
diff --git a/crates/openhuman-core/src/modules/storage_import_tinywallet_tests.rs b/crates/openhuman-core/src/modules/storage_import_tinywallet_tests.rs
index 3857958e18..5bcb32fb2e 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinywallet_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinywallet_tests.rs
@@ -1,11 +1,10 @@
use super::*;
use sha2::Digest;
-use tinystoragedrivers::{MemoryStorage, Scope, StorageBackend};
+use crate::storage::{Scope, Storage};
+use tinystoragedrivers_testkit::memory_storage;
-fn scoped() -> ScopedStorage {
- MemoryStorage::new()
- .for_scope(&Scope::new("module:tinywallet@local").unwrap())
- .unwrap()
+fn scoped() -> Storage {
+ memory_storage(&Scope::new("module:tinywallet@local").unwrap())
}
fn record(id: &str, status: &str) -> String {