Skip to content

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

test(openhuman-embed): split monolithic integration tests into per-case files

Steven Enamakelb8f2c41e464c
diff --git a/crates/openhuman-embed/tests/attached_tools_attached_tools_survive_clones_and_session_resume.rs b/crates/openhuman-embed/tests/attached_tools_attached_tools_survive_clones_and_session_resume.rs
new file mode 100644
index 0000000000..a39f3f8b7c
--- /dev/null
+++ b/crates/openhuman-embed/tests/attached_tools_attached_tools_survive_clones_and_session_resume.rs
@@ -0,0 +1,7 @@
+#[path = "support/attached_tools.rs"]
+mod scenarios;
+
+#[test]
+fn attached_tools_survive_clones_and_session_resume() {
+ scenarios::attached_tools_survive_clones_and_session_resume();
+}
diff --git a/crates/openhuman-embed/tests/attached_tools_attaching_before_first_turn_preserves_and_executes_native_tools.rs b/crates/openhuman-embed/tests/attached_tools_attaching_before_first_turn_preserves_and_executes_native_tools.rs
new file mode 100644
index 0000000000..f3e7e791d8
--- /dev/null
+++ b/crates/openhuman-embed/tests/attached_tools_attaching_before_first_turn_preserves_and_executes_native_tools.rs
@@ -0,0 +1,7 @@
+#[path = "support/attached_tools.rs"]
+mod scenarios;
+
+#[test]
+fn attaching_before_first_turn_preserves_and_executes_native_tools() {
+ scenarios::attaching_before_first_turn_preserves_and_executes_native_tools();
+}
diff --git a/crates/openhuman-embed/tests/attached_tools_permanent_metadata_requires_a_real_source.rs b/crates/openhuman-embed/tests/attached_tools_permanent_metadata_requires_a_real_source.rs
new file mode 100644
index 0000000000..d2a0e311fa
--- /dev/null
+++ b/crates/openhuman-embed/tests/attached_tools_permanent_metadata_requires_a_real_source.rs
@@ -0,0 +1,7 @@
+#[path = "support/attached_tools.rs"]
+mod scenarios;
+
+#[test]
+fn permanent_metadata_requires_a_real_source() {
+ scenarios::permanent_metadata_requires_a_real_source();
+}
diff --git a/crates/openhuman-embed/tests/host_only_tools_host_only_advertises_exactly_the_host_tools_under_a_bare_prompt.rs b/crates/openhuman-embed/tests/host_only_tools_host_only_advertises_exactly_the_host_tools_under_a_bare_prompt.rs
new file mode 100644
index 0000000000..9ebc0f38f1
--- /dev/null
+++ b/crates/openhuman-embed/tests/host_only_tools_host_only_advertises_exactly_the_host_tools_under_a_bare_prompt.rs
@@ -0,0 +1,7 @@
+#[path = "support/host_only_tools.rs"]
+mod scenarios;
+
+#[test]
+fn host_only_advertises_exactly_the_host_tools_under_a_bare_prompt() {
+ scenarios::host_only_advertises_exactly_the_host_tools_under_a_bare_prompt();
+}
diff --git a/crates/openhuman-embed/tests/host_only_tools_host_only_forces_read_only_access_and_sandbox.rs b/crates/openhuman-embed/tests/host_only_tools_host_only_forces_read_only_access_and_sandbox.rs
new file mode 100644
index 0000000000..887cbcd37a
--- /dev/null
+++ b/crates/openhuman-embed/tests/host_only_tools_host_only_forces_read_only_access_and_sandbox.rs
@@ -0,0 +1,7 @@
+#[path = "support/host_only_tools.rs"]
+mod scenarios;
+
+#[test]
+fn host_only_forces_read_only_access_and_sandbox() {
+ scenarios::host_only_forces_read_only_access_and_sandbox();
+}
diff --git a/crates/openhuman-embed/tests/host_only_tools_host_only_refuses_builtin_tools_the_model_names.rs b/crates/openhuman-embed/tests/host_only_tools_host_only_refuses_builtin_tools_the_model_names.rs
new file mode 100644
index 0000000000..f4ec4a87bc
--- /dev/null
+++ b/crates/openhuman-embed/tests/host_only_tools_host_only_refuses_builtin_tools_the_model_names.rs
@@ -0,0 +1,7 @@
+#[path = "support/host_only_tools.rs"]
+mod scenarios;
+
+#[test]
+fn host_only_refuses_builtin_tools_the_model_names() {
+ scenarios::host_only_refuses_builtin_tools_the_model_names();
+}
diff --git a/crates/openhuman-embed/tests/structured_turns_a_complete_json_value_with_a_length_finish_is_not_a_valid_answer.rs b/crates/openhuman-embed/tests/structured_turns_a_complete_json_value_with_a_length_finish_is_not_a_valid_answer.rs
new file mode 100644
index 0000000000..f84396d751
--- /dev/null
+++ b/crates/openhuman-embed/tests/structured_turns_a_complete_json_value_with_a_length_finish_is_not_a_valid_answer.rs
@@ -0,0 +1,7 @@
+#[path = "support/structured_turns.rs"]
+mod scenarios;
+
+#[test]
+fn a_complete_json_value_with_a_length_finish_is_not_a_valid_answer() {
+ scenarios::a_complete_json_value_with_a_length_finish_is_not_a_valid_answer();
+}
diff --git a/crates/openhuman-embed/tests/structured_turns_a_tool_loop_ends_in_a_structured_answer.rs b/crates/openhuman-embed/tests/structured_turns_a_tool_loop_ends_in_a_structured_answer.rs
new file mode 100644
index 0000000000..59afe0bb56
--- /dev/null
+++ b/crates/openhuman-embed/tests/structured_turns_a_tool_loop_ends_in_a_structured_answer.rs
@@ -0,0 +1,7 @@
+#[path = "support/structured_turns.rs"]
+mod scenarios;
+
+#[test]
+fn a_tool_loop_ends_in_a_structured_answer() {
+ scenarios::a_tool_loop_ends_in_a_structured_answer();
+}
diff --git a/crates/openhuman-embed/tests/structured_turns_empty_truncated_terminal_answers_use_only_the_explicit_repair_allowance.rs b/crates/openhuman-embed/tests/structured_turns_empty_truncated_terminal_answers_use_only_the_explicit_repair_allowance.rs
new file mode 100644
index 0000000000..ad8228886a
--- /dev/null
+++ b/crates/openhuman-embed/tests/structured_turns_empty_truncated_terminal_answers_use_only_the_explicit_repair_allowance.rs
@@ -0,0 +1,7 @@
+#[path = "support/structured_turns.rs"]
+mod scenarios;
+
+#[test]
+fn empty_truncated_terminal_answers_use_only_the_explicit_repair_allowance() {
+ scenarios::empty_truncated_terminal_answers_use_only_the_explicit_repair_allowance();
+}
diff --git a/crates/openhuman-embed/tests/structured_turns_shared_budget_stops_the_tool_loop_before_its_next_provider_call.rs b/crates/openhuman-embed/tests/structured_turns_shared_budget_stops_the_tool_loop_before_its_next_provider_call.rs
new file mode 100644
index 0000000000..9fa08556db
--- /dev/null
+++ b/crates/openhuman-embed/tests/structured_turns_shared_budget_stops_the_tool_loop_before_its_next_provider_call.rs
@@ -0,0 +1,7 @@
+#[path = "support/structured_turns.rs"]
+mod scenarios;
+
+#[test]
+fn shared_budget_stops_the_tool_loop_before_its_next_provider_call() {
+ scenarios::shared_budget_stops_the_tool_loop_before_its_next_provider_call();
+}
diff --git a/crates/openhuman-embed/tests/structured_turns_successful_turn_preserves_reported_charges_and_invalid_buyer_cost_is_unknown.rs b/crates/openhuman-embed/tests/structured_turns_successful_turn_preserves_reported_charges_and_invalid_buyer_cost_is_unknown.rs
new file mode 100644
index 0000000000..934fada547
--- /dev/null
+++ b/crates/openhuman-embed/tests/structured_turns_successful_turn_preserves_reported_charges_and_invalid_buyer_cost_is_unknown.rs
@@ -0,0 +1,7 @@
+#[path = "support/structured_turns.rs"]
+mod scenarios;
+
+#[test]
+fn successful_turn_preserves_reported_charges_and_invalid_buyer_cost_is_unknown() {
+ scenarios::successful_turn_preserves_reported_charges_and_invalid_buyer_cost_is_unknown();
+}
diff --git a/crates/openhuman-embed/tests/structured_turns_terminal_schema_validation_retries_without_accepting_a_wrong_type.rs b/crates/openhuman-embed/tests/structured_turns_terminal_schema_validation_retries_without_accepting_a_wrong_type.rs
new file mode 100644
index 0000000000..9fbe35b392
--- /dev/null
+++ b/crates/openhuman-embed/tests/structured_turns_terminal_schema_validation_retries_without_accepting_a_wrong_type.rs
@@ -0,0 +1,7 @@
+#[path = "support/structured_turns.rs"]
+mod scenarios;
+
+#[test]
+fn terminal_schema_validation_retries_without_accepting_a_wrong_type() {
+ scenarios::terminal_schema_validation_retries_without_accepting_a_wrong_type();
+}
diff --git a/crates/openhuman-embed/tests/structured_turns_untrusted_input_passes_the_prompt_guard_only_on_a_host_only_agent.rs b/crates/openhuman-embed/tests/structured_turns_untrusted_input_passes_the_prompt_guard_only_on_a_host_only_agent.rs
new file mode 100644
index 0000000000..c1de842082
--- /dev/null
+++ b/crates/openhuman-embed/tests/structured_turns_untrusted_input_passes_the_prompt_guard_only_on_a_host_only_agent.rs
@@ -0,0 +1,7 @@
+#[path = "support/structured_turns.rs"]
+mod scenarios;
+
+#[test]
+fn untrusted_input_passes_the_prompt_guard_only_on_a_host_only_agent() {
+ scenarios::untrusted_input_passes_the_prompt_guard_only_on_a_host_only_agent();
+}
diff --git a/crates/openhuman-embed/tests/attached_tools.rs b/crates/openhuman-embed/tests/support/attached_tools.rs
similarity index 98%
rename from crates/openhuman-embed/tests/attached_tools.rs
rename to crates/openhuman-embed/tests/support/attached_tools.rs
index f3af913c81..9ec7b79cf1 100644
--- a/crates/openhuman-embed/tests/attached_tools.rs
+++ b/crates/openhuman-embed/tests/support/attached_tools.rs
@@ -1,4 +1,4 @@
-mod common;
+use crate::common;
use common::{chat_completion, chat_requests, offline_config, runtime, stub_backend};
use openhuman_embed::session_store::SessionRef;
use openhuman_embed::{
@@ -31,8 +31,7 @@ impl Tool for Marker {
Ok(tinytools::ToolResult::success("accepted"))
}
}
-#[test]
-fn attached_tools_survive_clones_and_session_resume() {
+pub fn attached_tools_survive_clones_and_session_resume() {
let _runtime = RUNTIME_LOCK
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
@@ -283,8 +282,7 @@ fn attached_tools_survive_clones_and_session_resume() {
});
}
-#[test]
-fn attaching_before_first_turn_preserves_and_executes_native_tools() {
+pub fn attaching_before_first_turn_preserves_and_executes_native_tools() {
let _runtime = RUNTIME_LOCK
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
@@ -347,8 +345,7 @@ fn attaching_before_first_turn_preserves_and_executes_native_tools() {
});
}
-#[test]
-fn permanent_metadata_requires_a_real_source() {
+pub fn permanent_metadata_requires_a_real_source() {
let factory = HostTurnTools {
permanent: std::collections::HashSet::from(["missing_source".into()]),
..Default::default()
diff --git a/crates/openhuman-embed/tests/cron_agents.rs b/crates/openhuman-embed/tests/support/cron_agents.rs
similarity index 100%
rename from crates/openhuman-embed/tests/cron_agents.rs
rename to crates/openhuman-embed/tests/support/cron_agents.rs
diff --git a/crates/openhuman-embed/tests/host_only_tools.rs b/crates/openhuman-embed/tests/support/host_only_tools.rs
similarity index 97%
rename from crates/openhuman-embed/tests/host_only_tools.rs
rename to crates/openhuman-embed/tests/support/host_only_tools.rs
index d922f216d8..745bcd0253 100644
--- a/crates/openhuman-embed/tests/host_only_tools.rs
+++ b/crates/openhuman-embed/tests/support/host_only_tools.rs
@@ -4,7 +4,7 @@
//! to that catalog: no shell, writes, network, memory, skills, MCP or delegation.
//! Assertions inspect provider requests and attempted filesystem effects.
-mod common;
+use crate::common;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
@@ -149,8 +149,7 @@ fn system_text(request: &Request) -> String {
.join("\n")
}
-#[test]
-fn host_only_advertises_exactly_the_host_tools_under_a_bare_prompt() {
+pub fn host_only_advertises_exactly_the_host_tools_under_a_bare_prompt() {
let _guard = RUNTIME_LOCK
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
@@ -184,8 +183,7 @@ fn host_only_advertises_exactly_the_host_tools_under_a_bare_prompt() {
});
}
-#[test]
-fn host_only_refuses_builtin_tools_the_model_names() {
+pub fn host_only_refuses_builtin_tools_the_model_names() {
let _guard = RUNTIME_LOCK
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
@@ -248,8 +246,7 @@ fn host_only_refuses_builtin_tools_the_model_names() {
});
}
-#[test]
-fn host_only_forces_read_only_access_and_sandbox() {
+pub fn host_only_forces_read_only_access_and_sandbox() {
let _guard = RUNTIME_LOCK
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
diff --git a/crates/openhuman-embed/tests/structured_turns.rs b/crates/openhuman-embed/tests/support/structured_turns.rs
similarity index 96%
rename from crates/openhuman-embed/tests/structured_turns.rs
rename to crates/openhuman-embed/tests/support/structured_turns.rs
index c844a799bc..64b9d72257 100644
--- a/crates/openhuman-embed/tests/structured_turns.rs
+++ b/crates/openhuman-embed/tests/support/structured_turns.rs
@@ -7,7 +7,7 @@
//! answered, and the reasoning it spent). The document is untrusted data, so a
//! host-only agent may take it past the prompt guard; no other agent may.
-mod common;
+use crate::common;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
@@ -132,8 +132,7 @@ fn body(request: &Request) -> Value {
serde_json::from_slice(&request.body).expect("json body")
}
-#[test]
-fn a_tool_loop_ends_in_a_structured_answer() {
+pub fn a_tool_loop_ends_in_a_structured_answer() {
let _guard = RUNTIME_LOCK
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
@@ -197,8 +196,7 @@ fn a_tool_loop_ends_in_a_structured_answer() {
});
}
-#[test]
-fn successful_turn_preserves_reported_charges_and_invalid_buyer_cost_is_unknown() {
+pub fn successful_turn_preserves_reported_charges_and_invalid_buyer_cost_is_unknown() {
let _guard = RUNTIME_LOCK
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
@@ -252,8 +250,7 @@ fn successful_turn_preserves_reported_charges_and_invalid_buyer_cost_is_unknown(
});
}
-#[test]
-fn untrusted_input_passes_the_prompt_guard_only_on_a_host_only_agent() {
+pub fn untrusted_input_passes_the_prompt_guard_only_on_a_host_only_agent() {
let _guard = RUNTIME_LOCK
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
@@ -316,8 +313,7 @@ fn untrusted_input_passes_the_prompt_guard_only_on_a_host_only_agent() {
});
}
-#[test]
-fn terminal_schema_validation_retries_without_accepting_a_wrong_type() {
+pub fn terminal_schema_validation_retries_without_accepting_a_wrong_type() {
let _guard = RUNTIME_LOCK
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
@@ -362,8 +358,7 @@ fn terminal_schema_validation_retries_without_accepting_a_wrong_type() {
});
}
-#[test]
-fn a_complete_json_value_with_a_length_finish_is_not_a_valid_answer() {
+pub fn a_complete_json_value_with_a_length_finish_is_not_a_valid_answer() {
let _guard = RUNTIME_LOCK
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
@@ -407,8 +402,7 @@ fn a_complete_json_value_with_a_length_finish_is_not_a_valid_answer() {
});
}
-#[test]
-fn shared_budget_stops_the_tool_loop_before_its_next_provider_call() {
+pub fn shared_budget_stops_the_tool_loop_before_its_next_provider_call() {
let _guard = RUNTIME_LOCK
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
@@ -436,8 +430,7 @@ fn shared_budget_stops_the_tool_loop_before_its_next_provider_call() {
});
}
-#[test]
-fn empty_truncated_terminal_answers_use_only_the_explicit_repair_allowance() {
+pub fn empty_truncated_terminal_answers_use_only_the_explicit_repair_allowance() {
let _guard = RUNTIME_LOCK
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);