diff --git a/src/cron/cli.v b/src/cron/cli.v index 9bdec9a..8e6b0f1 100644 --- a/src/cron/cli.v +++ b/src/cron/cli.v @@ -12,6 +12,7 @@ pub: base_image string = 'archlinux:base-devel' } +// cmd returns the cli module that handles the cron daemon. pub fn cmd() cli.Command { return cli.Command{ name: 'cron' diff --git a/src/cron/cron.v b/src/cron/cron.v index 2526326..be37ffa 100644 --- a/src/cron/cron.v +++ b/src/cron/cron.v @@ -12,6 +12,7 @@ fn (r1 ScheduledBuild) < (r2 ScheduledBuild) bool { return r1.timestamp < r2.timestamp } +// cron starts a cron daemon & starts periodically scheduling builds. pub fn cron(conf Config) ? { ce := parse_expression('0 3') ? t := time.parse('2002-01-01 00:00:00') ? diff --git a/src/cron/expression_test.v b/src/cron/expression_test.v index ce8526b..0be9a64 100644 --- a/src/cron/expression_test.v +++ b/src/cron/expression_test.v @@ -25,4 +25,10 @@ fn test_next_simple() ? { util_test_time('0 3', '2002-01-01 04:00:00', '2002-01-02 03:00:00') ? util_test_time('0 3/4', '2002-01-01 04:00:00', '2002-01-01 07:00:00') ? + + // Overlap to next month + util_test_time('0 3', '2002-11-31 04:00:00', '2002-12-01 03:00:00') ? + + // Overlap to next year + util_test_time('0 3', '2002-12-31 04:00:00', '2003-01-01 03:00:00') ? }