Skip to content

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

fix(test): use local test lock and correct crate paths in rpc tests

Steven Enamakel1ef9139abc2a
diff --git a/crates/openhuman-rpc/src/server/http/inference_route_tests.rs b/crates/openhuman-rpc/src/server/http/inference_route_tests.rs
index 6cefcad526..8aa2783442 100644
--- a/crates/openhuman-rpc/src/server/http/inference_route_tests.rs
+++ b/crates/openhuman-rpc/src/server/http/inference_route_tests.rs
@@ -38,7 +38,7 @@ fn ensure_test_rpc_auth() -> String {
let tmp = tempfile::tempdir().expect("tempdir for token file");
openhuman_core::core::auth::init_rpc_token(tmp.path()).expect("init rpc auth token for http tests");
});
- crate::core::auth::get_rpc_token()
+ openhuman_core::core::auth::get_rpc_token()
.expect("rpc bearer must be installed after ensure_test_rpc_auth")
.to_string()
}
diff --git a/crates/openhuman-rpc/src/server/shims_tests.rs b/crates/openhuman-rpc/src/server/shims_tests.rs
index 25c807b8b9..323568f83d 100644
--- a/crates/openhuman-rpc/src/server/shims_tests.rs
+++ b/crates/openhuman-rpc/src/server/shims_tests.rs
@@ -65,12 +65,13 @@ async fn wait_until_port_released(port: u16) {
/// dedicated `tests/` binary where global pollution doesn't affect
/// siblings — tracked as a follow-up.
///
-/// To run manually: `cargo test --lib -p openhuman -- --ignored
+/// To run manually: `cargo test --lib -p openhuman-rpc -- --ignored
/// shutdown_token`.
#[tokio::test]
#[ignore = "calls full server bootstrap; leaks process-global state into sibling tests (#1552). Re-cover via integration test."]
async fn shutdown_token_stops_axum_listener_within_timeout() {
- let _signed_out_restore = openhuman_core::cron::scheduler_gate::SignedOutTestGuard::set(false);
+ // Ignored and run on its own, so a plain write needs no restore guard.
+ openhuman_core::cron::scheduler_gate::set_signed_out(false);
let workspace = tempfile::tempdir().expect("workspace tempdir");
diff --git a/crates/openhuman-rpc/src/server/testing.rs b/crates/openhuman-rpc/src/server/testing.rs
index 03f8b4f1fe..56078e6dca 100644
--- a/crates/openhuman-rpc/src/server/testing.rs
+++ b/crates/openhuman-rpc/src/server/testing.rs
@@ -1,7 +1,11 @@
//! Test-only helpers shared by the JSON-RPC test modules.
use std::ffi::OsString;
-use std::sync::MutexGuard;
+use std::sync::{Mutex, MutexGuard};
+
+/// Serializes the environment mutations this crate's tests make. Core's own
+/// test lock is private to core's test binary, which is a separate process.
+static TEST_ENV_LOCK: Mutex<()> = Mutex::new(());
pub(crate) struct EnvVarGuard {
old_values: Vec<(&'static str, Option<OsString>)>,
@@ -10,7 +14,7 @@ pub(crate) struct EnvVarGuard {
impl EnvVarGuard {
pub(crate) fn set_many(vars: Vec<(&'static str, OsString)>) -> Self {
- let lock = openhuman_core::config::TEST_ENV_LOCK
+ let lock = TEST_ENV_LOCK
.lock()
.expect("test env lock poisoned");
let mut old_values = Vec::with_capacity(vars.len());