From 0e1ac9cee1ae5197b6efcd91eccf1b8a344d1b59 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Tue, 3 Sep 2024 14:41:46 -0600 Subject: [PATCH] CI: make 110-history parallel-safe Add ci:parallel tags for Bats, and tweak one test to be safe Signed-off-by: Ed Santiago --- test/system/110-history.bats | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/test/system/110-history.bats b/test/system/110-history.bats index 17f9546b8a..ffc81f5a40 100644 --- a/test/system/110-history.bats +++ b/test/system/110-history.bats @@ -2,6 +2,7 @@ load helpers +# bats test_tags=ci:parallel @test "podman history - basic tests" { tests=" | .*[0-9a-f]\\\{12\\\} .* CMD .* LABEL @@ -23,17 +24,26 @@ load helpers done < <(parse_table "$tests") } +# bats test_tags=ci:parallel @test "podman history - custom format" { - run_podman history --format "{{.ID}}\t{{.ID}}" $IMAGE - od -c <<<$output - while IFS= read -r row; do - is "$row" ".* .*$" - done <<<$output + run_podman history --format "--{{.ID}}--{{.Created}}--{{.CreatedBy}}--" $IMAGE + defer-assertion-failures + + for i in $(seq 1 "${#lines[*]}"); do + # most layer IDs are "" but at least one should be a SHA + assert "${lines[$((i-1))]}" =~ "^--([0-9a-f]+|)--.* ago--/bin/sh -c.*" \ + "history line $i" + done + + # Normally this should be "[$IMAGE]" (bracket IMAGE bracket). + # When run in parallel with other tests, the image may have + # other tags. run_podman history --format "{{.Tags}}" $IMAGE - is "$output" "\[$IMAGE\].*" "podman history sets tags" + assert "${lines[0]}" =~ "( |\[)$IMAGE(\]| )" "podman history tags" } +# bats test_tags=ci:parallel @test "podman history - json" { # Sigh. Timestamp in .created can be '...Z' or '...-06:00' tests=" @@ -61,6 +71,7 @@ size | -\\\?[0-9]\\\+ done < <(parse_table "$tests") } +# bats test_tags=ci:parallel @test "podman image history Created" { # Values from image LIST run_podman image list --format '{{.CreatedSince}}\n{{.CreatedAt}}' $IMAGE