Skip to content

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

test(worker-c-modules): adapt channel-method assertions for shared process

Steven Enamakel99927e8584ce
diff --git a/tests/in_process/worker_c_modules_e2e.rs b/tests/in_process/worker_c_modules_e2e.rs
index 41fbbde783..8f15423f37 100644
--- a/tests/in_process/worker_c_modules_e2e.rs
+++ b/tests/in_process/worker_c_modules_e2e.rs
@@ -347,8 +347,11 @@ async fn channels_remaining_controller_paths_validate_without_live_services() {
// The managed-bot link flows need a TinyHumans account, so they are served
// by `openhuman-tinyhumans` (`hosted::channel_link`) and registered only
- // when `openhuman_tinyhumans::install` runs. This harness boots the core
- // alone, so they must be absent — same wire names, no core fallback.
+ // when `openhuman_tinyhumans::install` runs. Without it they must be absent
+ // — same wire names, no core fallback. `in_process_all` shares one process
+ // with suites that do boot the transport, so once it is installed the
+ // methods are legitimately present and answer for the missing session.
+ let hosted_layer_installed = crate::tinyhumans_boot::is_booted();
for (id, method) in [
(50, "openhuman.channels_telegram_login_start"),
(51, "openhuman.channels_discord_link_start"),
@@ -360,10 +363,17 @@ async fn channels_remaining_controller_paths_validate_without_live_services() {
.pointer("/error/message")
.and_then(Value::as_str)
.unwrap_or_default();
- assert!(
- message.contains("unknown method"),
- "{method} must be absent from a core without the hosted layer: {response}"
- );
+ if hosted_layer_installed {
+ assert!(
+ !message.contains("unknown method"),
+ "{method} must be served once the hosted layer is installed: {response}"
+ );
+ } else {
+ assert!(
+ message.contains("unknown method"),
+ "{method} must be absent from a core without the hosted layer: {response}"
+ );
+ }
}
}
diff --git a/tests/support/tinyhumans_boot.rs b/tests/support/tinyhumans_boot.rs
index 462bb01080..a22d55a196 100644
--- a/tests/support/tinyhumans_boot.rs
+++ b/tests/support/tinyhumans_boot.rs
@@ -23,3 +23,10 @@ pub fn boot() {
.expect("install the TinyHumans backend transport for tests");
});
}
+
+/// Whether [`boot`] has run in this process. A suite that asserts on a surface
+/// the hosted layer adds (or must not add) uses this when it shares a process
+/// with suites that boot the transport.
+pub fn is_booted() -> bool {
+ BOOT.is_completed()
+}