Skip to content

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

test(cron): add coverage for job builder and scheduler halt persistence

Steven Enamakel8bc96c25ecc4
diff --git a/crates/openhuman-core/src/cron/job_builder_tests.rs b/crates/openhuman-core/src/cron/job_builder_tests.rs
index cbe313da70..e825008197 100644
--- a/crates/openhuman-core/src/cron/job_builder_tests.rs
+++ b/crates/openhuman-core/src/cron/job_builder_tests.rs
@@ -88,7 +88,12 @@ fn origin_delivery_or_current_target_without_an_origin_is_an_error() {
let tmp = TempDir::new().unwrap();
let cfg = config(&tmp);
let mut i = input();
- i.delivery = Some(validation::default_delivery(Some(&web())));
+ i.delivery = Some(
+ crate::cron::client::blocking(&Config::default(), |config| async move {
+ crate::cron::client::default_delivery(&config, Some(&web())).await
+ })
+ .unwrap(),
+ );
assert!(create_agent_job(&cfg, i, None)
.unwrap_err()
.contains("origin"));
diff --git a/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs b/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs
index 5207069396..b87778bc15 100644
--- a/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs
@@ -361,7 +361,6 @@ async fn run_through_scheduler(config: &Config, job_id: &str) {
Utc::now() - ChronoDuration::seconds(1),
)
.unwrap();
- let job = cron::get_job(config, job_id).unwrap();
let security = Arc::new(SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,
@@ -372,7 +371,7 @@ async fn run_through_scheduler(config: &Config, job_id: &str) {
config,
&security,
);
- dispatcher.dispatch(vec![job]).await.unwrap();
+ dispatcher.tick(config).await.unwrap();
dispatcher.drain().await;
}
@@ -436,7 +435,7 @@ async fn scheduler_flow_runs_active_hours_job_and_reschedules_inside_window() {
&config,
&security,
);
- dispatcher.dispatch(vec![job.clone()]).await.unwrap();
+ dispatcher.tick(&config).await.unwrap();
dispatcher.drain().await;
let stored = cron::get_job(&config, &job.id).unwrap();