Skip to content

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

test: isolate host and embed tests from operator environment

Steven Enamakel971006dfd5ce
diff --git a/crates/openhuman-embed/tests/seams_runtime.rs b/crates/openhuman-embed/tests/seams_runtime.rs
index e1a1b3058b..814a921af3 100644
--- a/crates/openhuman-embed/tests/seams_runtime.rs
+++ b/crates/openhuman-embed/tests/seams_runtime.rs
@@ -63,6 +63,8 @@ fn hook_installed() -> bool {
#[test]
fn seams_are_live_after_build_and_unwound_on_drop() {
+ // The runtime must not pick up a storage backend from the operator's shell.
+ std::env::remove_var("OPENHUMAN_STORAGE_URL");
let tokio = runtime();
tokio.block_on(async {
tokio::spawn(async {
diff --git a/crates/openhuman-rpc/tests/host_cli.rs b/crates/openhuman-rpc/tests/host_cli.rs
index 1a5f2167d3..b12359db2e 100644
--- a/crates/openhuman-rpc/tests/host_cli.rs
+++ b/crates/openhuman-rpc/tests/host_cli.rs
@@ -6,6 +6,10 @@
fn cli_host_runs_help_and_returns_ok() {
let workspace = tempfile::tempdir().expect("workspace tempdir");
std::env::set_var("OPENHUMAN_WORKSPACE", workspace.path());
+ // Isolate from the operator's environment: a storage URL would route the
+ // session store to a real backend, and a backend URL to a real host.
+ std::env::remove_var("OPENHUMAN_STORAGE_URL");
+ std::env::set_var("BACKEND_URL", "http://127.0.0.1:9");
std::thread::Builder::new()
.stack_size(64 * 1024 * 1024)
diff --git a/crates/openhuman-rpc/tests/host_desktop.rs b/crates/openhuman-rpc/tests/host_desktop.rs
index c1c329c734..da46f41c80 100644
--- a/crates/openhuman-rpc/tests/host_desktop.rs
+++ b/crates/openhuman-rpc/tests/host_desktop.rs
@@ -41,6 +41,10 @@ fn free_loopback_port() -> u16 {
fn serve_desktop_signals_ready_serves_health_and_stops_on_shutdown() {
let workspace = tempfile::tempdir().expect("workspace tempdir");
std::env::set_var("OPENHUMAN_WORKSPACE", workspace.path());
+ // Isolate from the operator's environment: a storage URL would route the
+ // session store to a real backend, and a backend URL to a real host.
+ std::env::remove_var("OPENHUMAN_STORAGE_URL");
+ std::env::set_var("BACKEND_URL", "http://127.0.0.1:9");
std::env::set_var("OPENHUMAN_CORE_HOST", "127.0.0.1");
std::thread::Builder::new()
@@ -68,7 +72,8 @@ fn serve_desktop_signals_ready_serves_health_and_stops_on_shutdown() {
.await
.expect("ready signal within the timeout")
.expect("ready signal sent");
- assert_eq!(port, options.port.unwrap());
+ // The listener may fall back to another port if the one we
+ // probed was taken in between; use what it reports.
let health = reqwest::Client::new()
.get(format!("http://127.0.0.1:{port}/health"))
diff --git a/crates/openhuman-rpc/tests/host_tui.rs b/crates/openhuman-rpc/tests/host_tui.rs
index b4cfadd4a9..1bfe375e10 100644
--- a/crates/openhuman-rpc/tests/host_tui.rs
+++ b/crates/openhuman-rpc/tests/host_tui.rs
@@ -6,6 +6,10 @@
fn tui_host_builds_a_runtime_that_answers_a_read_rpc() {
let workspace = tempfile::tempdir().expect("workspace tempdir");
std::env::set_var("OPENHUMAN_WORKSPACE", workspace.path());
+ // Isolate from the operator's environment: a storage URL would route the
+ // session store to a real backend, and a backend URL to a real host.
+ std::env::remove_var("OPENHUMAN_STORAGE_URL");
+ std::env::set_var("BACKEND_URL", "http://127.0.0.1:9");
std::thread::Builder::new()
.stack_size(64 * 1024 * 1024)