The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(credentials): take the module lock without the test storage
M3gA-Mind1702b18357a1
diff --git a/crates/openhuman-core/src/integrations/composio/module_client.rs b/crates/openhuman-core/src/integrations/composio/module_client.rsindex 462400831a..f7f22220b7 100644--- a/crates/openhuman-core/src/integrations/composio/module_client.rs+++ b/crates/openhuman-core/src/integrations/composio/module_client.rs@@ -328,10 +328,7 @@ pub(crate) struct ModuleGuard {/// every build has), restored on drop.#[cfg(test)]pub(crate) async fn module_guard() -> ModuleGuard {- // Tests that take the module drive its backend mode against a local mock;- // give this thread the stand-in route a host would register.- super::test_backend_route::register();- let lock = MODULE_LOCK.lock().await;+ let lock = module_lock_guard().await;ModuleGuard {_storage: crate::storage::test_support::install_backend_for_test(crate::storage::test_support::memory_backend(),@@ -340,6 +337,16 @@ pub(crate) async fn module_guard() -> ModuleGuard {}}+/// The module lock without [`module_guard`]'s storage, for tests of the+/// process keyring: an installed backend moves user secrets into storage.+#[cfg(test)]+pub(crate) async fn module_lock_guard() -> tokio::sync::MutexGuard<'static, ()> {+ // Tests that take the module drive its backend mode against a local mock;+ // give this thread the stand-in route a host would register.+ super::test_backend_route::register();+ MODULE_LOCK.lock().await+}+#[cfg(test)]#[path = "module_client_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/security/credentials/ops_credential_tests.rs b/crates/openhuman-core/src/security/credentials/ops_credential_tests.rsindex d12602bca0..32b3f46cec 100644--- a/crates/openhuman-core/src/security/credentials/ops_credential_tests.rs+++ b/crates/openhuman-core/src/security/credentials/ops_credential_tests.rs@@ -389,7 +389,7 @@ async fn set_and_clear_api_key_credential() {async fn clearing_the_session_preserves_a_coexisting_api_key() {// Reaches the connector module, whose route is process-wide: hold the module// lock (before TEST_ENV_LOCK, the established order) for the whole test.- let _module = crate::integrations::composio::module_client::module_guard().await;+ let _module = crate::integrations::composio::module_client::module_lock_guard().await;let _env_guard = crate::config::TEST_ENV_LOCK.lock().await;let tmp = TempDir::new().unwrap();std::fs::create_dir_all(tmp.path().join("workspace")).unwrap();@@ -477,7 +477,7 @@ async fn clearing_the_session_preserves_a_coexisting_api_key() {async fn clearing_the_session_preserves_the_active_key_over_a_stale_destination_key() {// Reaches the connector module, whose route is process-wide: hold the module// lock (before TEST_ENV_LOCK, the established order) for the whole test.- let _module = crate::integrations::composio::module_client::module_guard().await;+ let _module = crate::integrations::composio::module_client::module_lock_guard().await;let _env_guard = crate::config::TEST_ENV_LOCK.lock().await;let tmp = TempDir::new().unwrap();std::fs::create_dir_all(tmp.path().join("workspace")).unwrap();@@ -568,7 +568,7 @@ async fn clearing_the_session_preserves_the_active_key_over_a_stale_destination_async fn clearing_without_a_kind_removes_a_user_scoped_api_key_at_its_source() {// Reaches the connector module, whose route is process-wide: hold the module// lock (before TEST_ENV_LOCK, the established order) for the whole test.- let _module = crate::integrations::composio::module_client::module_guard().await;+ let _module = crate::integrations::composio::module_client::module_lock_guard().await;let _env_guard = crate::config::TEST_ENV_LOCK.lock().await;let tmp = TempDir::new().unwrap();std::fs::create_dir_all(tmp.path().join("workspace")).unwrap();