2024-10-26 14:12:05 +02:00
|
|
|
module tests
|
|
|
|
|
|
|
|
open NUnit.Framework
|
|
|
|
open Pentole.TestsExtensions
|
2024-10-28 19:33:36 +01:00
|
|
|
open Bidello.Datatypes
|
|
|
|
open Bidello
|
|
|
|
|
|
|
|
open Pentole.String
|
2024-10-26 14:12:05 +02:00
|
|
|
|
|
|
|
[<Test>]
|
2024-10-28 19:33:36 +01:00
|
|
|
let string_prefix_active_pattern () =
|
|
|
|
match "@after job" with
|
|
|
|
| Prefix "@after" j -> Assert.Pass ()
|
|
|
|
| _ -> Assert.Pass ()
|
|
|
|
|
|
|
|
match "@after job " with
|
|
|
|
| Prefix "@after" j -> Assert.Pass ()
|
|
|
|
| _ -> Assert.Pass ()
|
|
|
|
|
|
|
|
let bj =
|
|
|
|
{ job_name = "j1"
|
|
|
|
hostname = "h1"
|
|
|
|
``when`` = "* * * * *"
|
|
|
|
executable = "echo"
|
|
|
|
workdir = "/"; user = "nobody"
|
|
|
|
args = [||]; environment = "";
|
|
|
|
done_at = None }
|
|
|
|
|
|
|
|
[<Test>]
|
|
|
|
let job_deps () =
|
|
|
|
|
|
|
|
let requirements = [
|
|
|
|
bj
|
|
|
|
{bj with job_name = "j2"}
|
|
|
|
{bj with hostname = "h2"}
|
|
|
|
{bj with job_name = "j1_after"; ``when``="@after j1"}
|
|
|
|
// TODO: another test with this at h2
|
|
|
|
]
|
|
|
|
|
|
|
|
let now = NodaTime.SystemClock.Instance.GetCurrentInstant ()
|
|
|
|
let cjs = Cron.sort_cron_jobs now requirements
|
|
|
|
|
|
|
|
Assert.ok_is_equal Seq.empty cjs
|