Skip to content

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

chore: files changed crates/openhuman-rpc/src/session_store/mod_tests.rs

Steven Enamakel2f8e06470802
diff --git a/crates/openhuman-rpc/src/session_store/mod_tests.rs b/crates/openhuman-rpc/src/session_store/mod_tests.rs
index 144ff0bfd6..3363057854 100644
--- a/crates/openhuman-rpc/src/session_store/mod_tests.rs
+++ b/crates/openhuman-rpc/src/session_store/mod_tests.rs
@@ -91,70 +91,6 @@ async fn the_sqlite_backend_keeps_agents_apart() {
driver_backed_store_keeps_agents_apart(url, "sqlite").await;
}
-#[cfg(feature = "storage-file")]
-#[tokio::test(flavor = "multi_thread")]
-async fn the_file_backend_keeps_agents_apart() {
- let dir = tempfile::tempdir().unwrap();
- let url = format!("file:{}", dir.path().join("files").display());
- driver_backed_store_keeps_agents_apart(url, "file").await;
-}
-
-/// Whether every seed host of a MongoDB URL is exactly the local machine
-/// (`localhost`, `127.0.0.1` or `::1`); a prefix match would accept
-/// `127.0.0.1.example.com`. Same rule as the root suites' helper
-/// (`tests/support/storage_drivers.rs`).
-#[cfg(feature = "storage-mongodb")]
-fn is_loopback_mongo_url(url: &str) -> bool {
- let rest = url.split_once("://").map_or(url, |(_, rest)| rest);
- let authority = rest.split(['/', '?']).next().unwrap_or_default();
- let hosts = authority.rsplit_once('@').map_or(authority, |(_, h)| h);
- !hosts.is_empty()
- && !url.starts_with("mongodb+srv://")
- && hosts.split(',').all(|host| {
- let name = if let Some(v6) = host.strip_prefix('[') {
- v6.split(']').next().unwrap_or_default()
- } else {
- host.rsplit_once(':').map_or(host, |(name, _)| name)
- };
- matches!(name, "localhost" | "127.0.0.1" | "::1")
- })
-}
-
-/// Runs against `TSD_MONGO_URL` (a throwaway local replica set, as the
-/// `Storage (MongoDB)` workflow starts) in a database of its own; skipped
-/// when it is unset or names a host other than this machine.
-#[cfg(feature = "storage-mongodb")]
-#[tokio::test(flavor = "multi_thread")]
-async fn the_mongodb_backend_keeps_agents_apart() {
- let Some(base) = std::env::var("TSD_MONGO_URL")
- .ok()
- .filter(|url| !url.trim().is_empty())
- else {
- eprintln!("skipped mongodb: TSD_MONGO_URL is not set");
- return;
- };
- if !is_loopback_mongo_url(&base) {
- eprintln!("skipped mongodb: TSD_MONGO_URL must name a local server");
- return;
- }
- let (head, query) = match base.split_once('?') {
- Some((head, query)) => (head, format!("?{query}")),
- None => (base.as_str(), String::new()),
- };
- let authority_end = head[head.find("://").map_or(0, |at| at + 3)..]
- .find('/')
- .map_or(head.len(), |at| head.find("://").map_or(0, |i| i + 3) + at);
- let nanos = std::time::SystemTime::now()
- .duration_since(std::time::UNIX_EPOCH)
- .map_or(0, |d| d.as_nanos());
- let url = format!(
- "{}/oh_rpc_{nanos:x}_{}{query}",
- &head[..authority_end],
- std::process::id()
- );
- driver_backed_store_keeps_agents_apart(url, "mongodb").await;
-}
-
#[tokio::test]
async fn an_unusable_url_fails_the_boot() {
let _turn = SLOTS.lock().await;