Skip to content

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

test(storage): wait for probe module to claim its bus name

Steven Enamakel400412937d3e
diff --git a/crates/openhuman-core/src/modules/storage_host_cdylib_tests.rs b/crates/openhuman-core/src/modules/storage_host_cdylib_tests.rs
index a17ebdc92c..cf2bcb6a3c 100644
--- a/crates/openhuman-core/src/modules/storage_host_cdylib_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_host_cdylib_tests.rs
@@ -188,6 +188,16 @@ async fn rig(module_id: &'static str) -> Rig {
let staged = tempfile::tempdir().unwrap();
let artifact = stage(staged.path());
modules.load_file(&artifact).expect("load the probe cdylib");
+ // `load_file` can return before the module's setup claims its name.
+ let probe_name = BusName::new(PROBE).expect("probe bus name");
+ let deadline = std::time::Instant::now() + std::time::Duration::from_secs(10);
+ while !matches!(stranger.name_owner(&probe_name).await, Ok(Some(_))) {
+ assert!(
+ std::time::Instant::now() < deadline,
+ "the probe module never claimed {PROBE}"
+ );
+ tokio::time::sleep(std::time::Duration::from_millis(20)).await;
+ }
let probe = stranger.proxy(PROBE, "/probe", PROBE).unwrap();
Rig {
backend,
diff --git a/crates/openhuman-core/src/storage/blob_sweep_tests.rs b/crates/openhuman-core/src/storage/blob_sweep_tests.rs
index c36e84e8ef..0ecb205ce0 100644
--- a/crates/openhuman-core/src/storage/blob_sweep_tests.rs
+++ b/crates/openhuman-core/src/storage/blob_sweep_tests.rs
@@ -75,6 +75,7 @@ async fn sweeping_through_the_fenced_backend_reaches_the_driver() {
assert_eq!(sweep_scope(fenced.as_ref(), &scope).await, 1);
}
+#[cfg(feature = "modules")]
#[tokio::test]
async fn module_blob_scopes_are_swept_alongside_the_acting_scope() {
let (now, backend) = backend_with_clock();
@@ -84,3 +85,9 @@ async fn module_blob_scopes_are_swept_alongside_the_acting_scope() {
now.store(2_000, Ordering::SeqCst);
assert_eq!(sweep_all(backend).await, 1);
}
+
+#[cfg(not(feature = "modules"))]
+#[test]
+fn no_module_blob_scopes_without_the_modules_feature() {
+ assert!(crate::modules::expiring_blob_module_scopes().is_empty());
+}