Skip to content

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

test(cron): rework timing probe to measure runtime and attach

Steven Enamakelef39594c2a54
diff --git a/crates/openhuman-core/src/cron/client_tests.rs b/crates/openhuman-core/src/cron/client_tests.rs
index 0fe30f40c7..f9b4434bc0 100644
--- a/crates/openhuman-core/src/cron/client_tests.rs
+++ b/crates/openhuman-core/src/cron/client_tests.rs
@@ -3,14 +3,10 @@ use std::time::Instant;
#[tokio::test]
async fn timing_probe() {
- let config = Config::default();
let t = Instant::now();
- crate::modules::tinyflows::proxy(&config).await.unwrap();
- eprintln!("attach: {:?}", t.elapsed());
- let t = Instant::now();
- let normalized = normalize_expression(&config, "0 9 * * 1-5").await.unwrap();
- eprintln!("first call: {:?} -> {normalized}", t.elapsed());
+ let _ = crate::modules::runtime::runtime().await.unwrap();
+ eprintln!("runtime: {:?}", t.elapsed());
let t = Instant::now();
- normalize_expression(&config, "0 9 * * 1-5").await.unwrap();
- eprintln!("second call: {:?}", t.elapsed());
+ crate::modules::tinyflows::fixture_attach_for_probe().await.unwrap();
+ eprintln!("attach: {:?}", t.elapsed());
}
diff --git a/crates/openhuman-core/src/modules/tinyflows.rs b/crates/openhuman-core/src/modules/tinyflows.rs
index 0ff83b78a6..3c8c6f87e2 100644
--- a/crates/openhuman-core/src/modules/tinyflows.rs
+++ b/crates/openhuman-core/src/modules/tinyflows.rs
@@ -152,6 +152,11 @@ mod imp {
});
}
+ #[cfg(test)]
+ pub(crate) async fn fixture_attach_for_probe() -> Result<(), String> {
+ fixture::attach().await
+ }
+
/// The tinyflows module linked into the test binary.
#[cfg(test)]
pub(crate) mod fixture {
@@ -180,6 +185,8 @@ mod imp {
#[cfg(feature = "modules")]
pub(crate) use imp::{proxy, run_proxy, serve, unserve};
+#[cfg(all(test, feature = "modules"))]
+pub(crate) use imp::fixture_attach_for_probe;
#[cfg(not(feature = "modules"))]
mod imp {