Bidello/tests/UnitTest1.fs
bparodi@lezzo.org 474f0f1a04 tests
2024-10-28 19:33:36 +01:00

43 lines
978 B
Forth

module tests
open NUnit.Framework
open Pentole.TestsExtensions
open Bidello.Datatypes
open Bidello
open Pentole.String
[<Test>]
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