From 14c52dd8b02627adb2f25e5ce0b9ba4dabe6d46a Mon Sep 17 00:00:00 2001 From: hugocasa Date: Fri, 28 Aug 2026 17:11:10 +0200 Subject: [PATCH] test: pin the interval to the cron's shortest gap --- backend/windmill-api-schedule/src/lib.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/backend/windmill-api-schedule/src/lib.rs b/backend/windmill-api-schedule/src/lib.rs index f6a087e3ae..460c2607cd 100644 --- a/backend/windmill-api-schedule/src/lib.rs +++ b/backend/windmill-api-schedule/src/lib.rs @@ -1747,3 +1747,19 @@ pub struct SetEnabled { // pub from: DateTime, // pub to: Option>, // } + +#[cfg(test)] +mod tests { + use super::*; + + /// Twice a day, so the gaps alternate 8 hours and 16. A run only has to + /// outlast the shorter one to start skipping slots, so that is the number + /// the interval has to be. + #[test] + fn interval_is_the_shortest_gap_an_irregular_cron_leaves() { + assert_eq!( + configured_interval_s("0 0 9,17 * * *", Some("v2"), "UTC"), + Some(8 * 3600) + ); + } +}