Skip to content

Commit

Permalink
Merge pull request #23592 from edsantiago/safename-080
Browse files Browse the repository at this point in the history
CI: 080-pause.bats: make parallel-safe
  • Loading branch information
openshift-merge-bot[bot] authored Aug 13, 2024
2 parents 1bf711e + 36f9a04 commit a4c6bef
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions test/system/080-pause.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

0 comments on commit a4c6bef

Please sign in to comment.