From 36f9a044991c9b00cbada4402a391c81b9e7bbf7 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Thu, 8 Aug 2024 06:14:37 -0600 Subject: [PATCH] CI: 080-pause.bats: make parallel-safe Only one test can be parallelized. Do so, and add a comment to the other one explaining why it can't be. Also, add some missing error-message checks. Signed-off-by: Ed Santiago --- test/system/080-pause.bats | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/test/system/080-pause.bats b/test/system/080-pause.bats index f9e632c42c..8d9b760f74 100644 --- a/test/system/080-pause.bats +++ b/test/system/080-pause.bats @@ -5,13 +5,13 @@ load helpers -# bats test_tags=distro-integration +# bats test_tags=distro-integration, ci:parallel @test "podman pause/unpause" { if is_rootless && ! is_cgroupsv2; then skip "'podman pause' (rootless) only works with cgroups v2" fi - cname=$(random_string 10) + cname="c-$(safename)" run_podman run -d --name $cname $IMAGE \ sh -c 'while :;do date +%s;sleep 1;done' cid="$output" @@ -28,10 +28,10 @@ load helpers is "$output" "paused" "podman inspect .State.Status" sleep 3 run_podman ps -a --format '{{.ID}} {{.Names}} {{.Status}}' - is "$output" "${cid:0:12} $cname Paused" "podman ps on paused container" + assert "$output" =~ ".*${cid:0:12} $cname Paused.*" "podman ps on paused container" run_podman unpause $cname run_podman ps -a --format '{{.ID}} {{.Names}} {{.Status}}' - is "$output" "${cid:0:12} $cname Up .*" "podman ps on resumed container" + assert "$output" =~ ".*${cid:0:12} $cname Up .*" "podman ps on resumed container" sleep 1 # Get full logs, and iterate through them computing delta_t between entries @@ -54,19 +54,26 @@ load helpers # Pause/unpause on nonexistent name or id - these should all fail run_podman 125 pause $cid + assert "$output" =~ "no container with name or ID \"$cid\" found: no such container" run_podman 125 pause $cname + assert "$output" =~ "no container with name or ID \"$cname\" found: no such container" run_podman 125 unpause $cid + assert "$output" =~ "no container with name or ID \"$cid\" found: no such container" run_podman 125 unpause $cname + assert "$output" =~ "no container with name or ID \"$cname\" found: no such container" } +# CANNOT BE PARALLELIZED! (because of unpause --all) # bats test_tags=distro-integration @test "podman unpause --all" { if is_rootless && ! is_cgroupsv2; then skip "'podman pause' (rootless) only works with cgroups v2" fi - cname=$(random_string 10) - run_podman create --name notrunning $IMAGE + cname="c-$(safename)" + cname_notrunning="c-notrunning-$(safename)" + + run_podman create --name $cname_notrunning $IMAGE run_podman run -d --name $cname $IMAGE sleep 100 cid="$output" run_podman pause $cid @@ -76,8 +83,7 @@ load helpers is "$output" "$cid" "podman unpause output" run_podman ps --format '{{.ID}} {{.Names}} {{.Status}}' is "$output" "${cid:0:12} $cname Up.*" "podman ps on resumed container" - run_podman stop -t 0 $cname - run_podman rm -t 0 -f $cname - run_podman rm -t 0 -f notrunning + + run_podman rm -t 0 -f $cname $cname_notrunning } # vim: filetype=sh