Skip to content

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

test(harness): remove tests that are now covered by runtime builder tests

Steven Enamakeldaccaabd9163
diff --git a/crates/openhuman-embed/src/harness/builder_tests.rs b/crates/openhuman-embed/src/harness/builder_tests.rs
index 619c487456..ba3a10e340 100644
--- a/crates/openhuman-embed/src/harness/builder_tests.rs
+++ b/crates/openhuman-embed/src/harness/builder_tests.rs
@@ -7,10 +7,11 @@
//! `tests/harness_embed.rs`, which owns its process.
//!
//! The tests that *do* call `build()` are the ones that fail before it — and
-//! they serialize on [`GUARD`], because `HARNESS_LIVE` is process-wide and
+//! they serialize on [`GUARD`], because the runtime slot is process-wide and
//! `cargo test` runs threads in parallel.
use super::*;
+use crate::runtime::builder::apply_provider;
use openhuman_core::config::Config;
/// Serializes the tests that claim the process-wide harness slot.
@@ -26,38 +27,6 @@ fn a_harness_identifies_as_a_library_host_by_default() {
assert_eq!(HarnessBuilder::new().host_kind, HostKind::Library);
}
-#[test]
-fn inherited_workspace_and_provider_keep_installed_session_policy() {
- assert_eq!(
- effective_host_kind(HostKind::Library, true, false),
- HostKind::Cli
- );
- assert_eq!(
- effective_host_kind(HostKind::Library, true, true),
- HostKind::Library
- );
- assert_eq!(
- effective_host_kind(HostKind::Library, false, false),
- HostKind::Library
- );
-}
-
-#[test]
-fn default_services_start_no_background_writers() {
- // cron, heartbeat and the memory queue each write to the workspace on their
- // own schedule. A library call that started them would become a background
- // process the caller never asked for.
- let services = default_services();
- assert!(services.harness_init, "the agent harness must be prepared");
- assert!(!services.cron);
- assert!(!services.heartbeat);
- assert!(!services.memory_queue);
- assert!(!services.rpc_http, "a library call binds no port");
- assert!(!services.socketio);
- assert!(!services.channels);
- assert!(!services.update_scheduler);
-}
-
#[test]
fn a_provider_model_becomes_the_config_default() {
let mut config = Config::default();
@@ -127,7 +96,7 @@ async fn a_failed_build_releases_the_process_slot() {
"the slot leaked from the previous failed build"
);
}
- assert!(!HARNESS_LIVE.load(std::sync::atomic::Ordering::Acquire));
+ assert!(!crate::runtime::RUNTIME_LIVE.load(std::sync::atomic::Ordering::Acquire));
}
#[cfg(feature = "mcp")]
@@ -163,7 +132,7 @@ async fn an_inherited_workspace_still_applies_the_builder_knobs() {
..Default::default()
};
- // What `build_inner` does to a config once it has one, in order.
+ // What `RuntimeBuilder::build` does to a config once it has one, in order.
let backend_url = Some("https://harness.example".to_string());
if let Some(url) = backend_url {
config.api_url = Some(url);
diff --git a/crates/openhuman-embed/src/runtime/builder_tests.rs b/crates/openhuman-embed/src/runtime/builder_tests.rs
new file mode 100644
index 0000000000..28e460fdd1
--- /dev/null
+++ b/crates/openhuman-embed/src/runtime/builder_tests.rs
@@ -0,0 +1,67 @@
+//! Tests for the pure assembly logic.
+//!
+//! Nothing here builds a real core: `build()` initializes process-global state
+//! (keyring, event bus, `Once`-guarded subscribers) that a unit test cannot
+//! undo. The end-to-end path is covered by `tests/harness_embed.rs` and
+//! `tests/runtime_agents.rs`, which each own their process. The tests that
+//! *do* call `build()` are the ones that fail before it.
+
+use super::*;
+
+#[test]
+fn a_runtime_identifies_as_a_library_host_by_default() {
+ assert_eq!(RuntimeBuilder::new().host_kind, HostKind::Library);
+}
+
+#[test]
+fn inherited_workspace_without_a_host_credential_keeps_installed_session_policy() {
+ assert_eq!(
+ effective_host_kind(HostKind::Library, true, false),
+ HostKind::Cli
+ );
+ assert_eq!(
+ effective_host_kind(HostKind::Library, true, true),
+ HostKind::Library
+ );
+ assert_eq!(
+ effective_host_kind(HostKind::Library, false, false),
+ HostKind::Library
+ );
+}
+
+#[test]
+fn default_services_start_no_background_writers() {
+ // cron, heartbeat and the memory queue each write to the workspace on their
+ // own schedule. A library call that started them would become a background
+ // process the caller never asked for.
+ let services = default_services();
+ assert!(services.harness_init, "the agent harness must be prepared");
+ assert!(!services.cron);
+ assert!(!services.heartbeat);
+ assert!(!services.memory_queue);
+ assert!(!services.rpc_http, "a library call binds no port");
+ assert!(!services.socketio);
+ assert!(!services.channels);
+ assert!(!services.update_scheduler);
+}
+
+#[test]
+fn default_domains_register_what_agents_can_only_narrow() {
+ let domains = default_domains();
+ assert!(domains.inference, "turns need the inference family");
+ #[cfg(feature = "mcp")]
+ assert!(domains.mcp, "agents cannot enable mcp later");
+ #[cfg(feature = "skills")]
+ assert!(domains.skills, "agents cannot enable skills later");
+}
+
+#[tokio::test]
+async fn a_blank_api_key_is_refused_before_the_slot_is_claimed() {
+ let err = RuntimeBuilder::new()
+ .api_key(" ")
+ .build()
+ .await
+ .expect_err("blank key");
+ assert!(matches!(err, RuntimeError::BlankApiKey), "{err:?}");
+ assert!(!RUNTIME_LIVE.load(std::sync::atomic::Ordering::Acquire));
+}