Skip to content

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

test(cron): cover renaming an enabled job at the active limit

Steven Enamakel7ce93ceb2e96
diff --git a/crates/openhuman-core/src/cron/limits_tests.rs b/crates/openhuman-core/src/cron/limits_tests.rs
index 472919bb73..f7614a6757 100644
--- a/crates/openhuman-core/src/cron/limits_tests.rs
+++ b/crates/openhuman-core/src/cron/limits_tests.rs
@@ -132,6 +132,25 @@ fn active_jobs_are_capped_by_the_store_count() {
assert!(get_job(&config, &third.id).unwrap().enabled);
}
+#[test]
+fn renaming_an_enabled_job_does_not_consume_another_slot() {
+ let tmp = TempDir::new().unwrap();
+ let mut config = limited(&tmp);
+ config.cron.max_active_jobs = 1;
+ let job = create_agent_job(&config, input(600_000, None), origin()).unwrap();
+
+ let renamed = update_job(
+ &config,
+ &job.id,
+ CronJobPatch {
+ name: Some(Some("renamed".into())),
+ ..CronJobPatch::default()
+ },
+ )
+ .expect("updating the existing enabled job must not consume capacity");
+ assert_eq!(renamed.name.as_deref(), Some("renamed"));
+}
+
#[test]
fn stored_rows_that_break_the_limits_are_refused_at_run() {
let tmp = TempDir::new().unwrap();