diff --git a/Project.toml b/Project.toml index f6afbd4..ad1c4d5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "SweepRunner" uuid = "be946ad2-3cb3-4b6e-8f7e-4a5ecc3c255b" -version = "0.6.7" +version = "0.6.8" authors = ["sota shimozono "] [deps] diff --git a/test/run/test_run_deadline.jl b/test/run/test_run_deadline.jl index 14a0107..8c466bd 100644 --- a/test/run/test_run_deadline.jl +++ b/test/run/test_run_deadline.jl @@ -52,8 +52,16 @@ end keys = ParamIO.expand(v.spec) @test length(keys) > 1 started = Ref(0) - deadline = time() + 0.3 - work = k -> (started[] += 1; sleep(0.6); Dict{String,Any}("x" => 1)) + # The first key runs until the deadline has passed, so the test does not depend on how long + # `run!` takes to hand it out — only that it is under the margin. A 0.3 s margin was not: + # a run-start observation takes most of a second, and on a hosted runner no key was handed + # out at all (started == 0). + deadline = time() + 5.0 + work = k -> begin + started[] += 1 + sleep(max(0.0, deadline - time()) + 0.1) + Dict{String,Any}("x" => 1) + end r = run!(work, v, keys; opts=RunOpts(workers=:sequential, deadline=deadline)) @test started[] >= 1 # the first key ran @test started[] < length(keys) # later keys were not handed out diff --git a/test/run/test_run_loop_busy.jl b/test/run/test_run_loop_busy.jl index 75e8500..acaee9b 100644 --- a/test/run/test_run_loop_busy.jl +++ b/test/run/test_run_loop_busy.jl @@ -48,7 +48,11 @@ end @test n[] == 1 # it ran the key @test DataVault.is_done(v, ks[1]) # and the campaign is complete @test r.done == 1 - @test elapsed >= 3.0 # it waited stale_after out rather than giving up + # It waited stale_after out rather than giving up (the bug gave up after two empty rounds, + # ~1 s). Less one second: DataVault writes `heartbeat=` truncated to the second, so the lock + # reads up to 1 s older than it is and is reclaimed up to 1 s before stale_after. Asserting + # the full 3.0 failed on hosted runners at 2.85 s and 2.90 s. + @test elapsed >= 3.0 - 1.0 end end