Skip to content

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

test(mcp): cover close failure in module client tests

Steven Enamakele8d002fc2d85
diff --git a/crates/openhuman-core/src/mcp/module_client_tests.rs b/crates/openhuman-core/src/mcp/module_client_tests.rs
index 73b40033e8..f0c53b2063 100644
--- a/crates/openhuman-core/src/mcp/module_client_tests.rs
+++ b/crates/openhuman-core/src/mcp/module_client_tests.rs
@@ -16,6 +16,7 @@ struct FakePort {
release_call: Arc<Notify>,
block_first_open: Arc<std::sync::atomic::AtomicBool>,
block_first_close: Arc<std::sync::atomic::AtomicBool>,
+ fail_first_close: Arc<std::sync::atomic::AtomicBool>,
block_calls: Arc<std::sync::atomic::AtomicBool>,
}
@@ -55,6 +56,12 @@ impl McpModulePort for FakePort {
closed.len()
};
self.close_started.notify_one();
+ if self
+ .fail_first_close
+ .swap(false, std::sync::atomic::Ordering::SeqCst)
+ {
+ return Err(ModuleCallError::TransportFailed);
+ }
if index == 1
&& self
.block_first_close