|
| 1 | +""" |
| 2 | +Tests for recur-git checkpoint lane coverage |
| 3 | +=========================================== |
| 4 | +
|
| 5 | +Verifies that `recur-git checkpoint --snapshot` surfaces active state for the |
| 6 | +agent vault lanes declared in `.recur/config.toml`. |
| 7 | +""" |
| 8 | + |
| 9 | +include("runtests.setup.jl") |
| 10 | + |
| 11 | +const RECUR_GIT_BIN = let |
| 12 | + repo_root = normpath(joinpath(@__DIR__, "..")) |
| 13 | + ext = Sys.iswindows() ? ".exe" : "" |
| 14 | + debug_bin = joinpath(repo_root, "target", "debug", "recur-git" * ext) |
| 15 | + release_bin = joinpath(repo_root, "target", RECUR_PROFILE, "recur-git" * ext) |
| 16 | + isfile(debug_bin) ? debug_bin : release_bin |
| 17 | +end |
| 18 | + |
| 19 | +function run_recur_git(args::Vector{String}) |
| 20 | + repo_root = normpath(joinpath(@__DIR__, "..")) |
| 21 | + display_cmd = join(map(arg -> contains(arg, ' ') ? "\"$arg\"" : arg, args), " ") |
| 22 | + println(" -> recur-git $display_cmd") |
| 23 | + |
| 24 | + cmd = Cmd(`$RECUR_GIT_BIN $args`, dir=repo_root) |
| 25 | + out = IOBuffer() |
| 26 | + err = IOBuffer() |
| 27 | + success = true |
| 28 | + |
| 29 | + try |
| 30 | + run(pipeline(cmd, stdout=out, stderr=err)) |
| 31 | + catch e |
| 32 | + if isa(e, ProcessFailedException) |
| 33 | + success = false |
| 34 | + else |
| 35 | + return (false, "", "Error running command: $e") |
| 36 | + end |
| 37 | + end |
| 38 | + |
| 39 | + return (success, String(take!(out)), String(take!(err))) |
| 40 | +end |
| 41 | + |
| 42 | +@testset "recur-git checkpoint lane coverage" begin |
| 43 | + log_section("Testing: recur-git checkpoint lane coverage") |
| 44 | + |
| 45 | + @testset "checkpoint snapshot includes active agent vault lanes" begin |
| 46 | + _, output, error_output = run_recur_git(["checkpoint", "--snapshot"]) |
| 47 | + snapshot_text = output * error_output |
| 48 | + |
| 49 | + @test contains(snapshot_text, "lane.state.skippy1.current:") |
| 50 | + @test contains(snapshot_text, "lane.state.skippy2.current:") |
| 51 | + @test contains(snapshot_text, "lane.state.test-monkey.current:") |
| 52 | + @test contains(snapshot_text, "lane.state.git-monkey.current:") |
| 53 | + end |
| 54 | +end |
0 commit comments