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-tinyhumans/src/transport/transport_tests.rs

Steven Enamakeld0491be53c85
diff --git a/crates/openhuman-tinyhumans/src/transport/transport_tests.rs b/crates/openhuman-tinyhumans/src/transport/transport_tests.rs
index 990ef2e01a..35ac7f59c0 100644
--- a/crates/openhuman-tinyhumans/src/transport/transport_tests.rs
+++ b/crates/openhuman-tinyhumans/src/transport/transport_tests.rs
@@ -7,6 +7,13 @@ use serde_json::json;
use wiremock::matchers::{header, header_exists, method, path};
use wiremock::{Mock, MockServer, ResponseTemplate};
+/// `install` writes the core's process-global transport slot; the tests that
+/// touch it must not interleave.
+fn global_lock() -> &'static std::sync::Mutex<()> {
+ static LOCK: std::sync::OnceLock<std::sync::Mutex<()>> = std::sync::OnceLock::new();
+ LOCK.get_or_init(|| std::sync::Mutex::new(()))
+}
+
fn request<'a>(
base: &'a str,
method: reqwest::Method,
@@ -180,7 +187,7 @@ async fn sdk_route_policy_refuses_unexposed_routes_before_sending() {
#[tokio::test]
async fn install_makes_the_core_resolve_this_transport() {
- // Serialised through the install slot; the core's global is process state.
+ let _guard = global_lock().lock().unwrap_or_else(|p| p.into_inner());
let _t = crate::install(crate::InstallOptions::default()).unwrap();
assert!(crate::is_installed());
assert_eq!(resolve_backend_transport().unwrap().name(), "tinyhumans-sdk");
@@ -204,6 +211,7 @@ async fn backend_client_round_trips_through_the_installed_transport() {
.mount(&server)
.await;
+ let _guard = global_lock().lock().unwrap_or_else(|p| p.into_inner());
let _t = crate::install(crate::InstallOptions::default()).unwrap();
let client = openhuman_core::api::BackendOAuthClient::new(&server.uri()).unwrap();
let value = client