Skip to content

Commit

Permalink
Merge pull request #24392 from edsantiago/parallelize-520
Browse files Browse the repository at this point in the history
CI: parallelize 520-checkpoint tests
  • Loading branch information
openshift-merge-bot[bot] authored Oct 28, 2024
2 parents 19f7be8 + 10d056c commit 2cbb2e8
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions test/system/520-checkpoint.bats
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ function setup() {
basic_setup
}

function teardown() {
run_podman '?' volume rm myvol

basic_teardown
}

# bats test_tags=ci:parallel
@test "podman checkpoint - basic test" {
run_podman run -d $IMAGE sh -c 'while :;do cat /proc/uptime; sleep 0.1;done'
local cid="$output"
Expand Down Expand Up @@ -114,6 +109,7 @@ function teardown() {
run_podman rm -t 0 -f $cid
}

# CANNOT BE PARALLELIZED: checkpoint -a
@test "podman checkpoint/restore print IDs or raw input" {
# checkpoint/restore -a must print the IDs
run_podman run -d $IMAGE top
Expand All @@ -124,7 +120,7 @@ function teardown() {
is "$output" "$ctrID"

# checkpoint/restore $input must print $input
cname=$(random_string)
cname=c-$(safename)
run_podman run -d --name $cname $IMAGE top
run_podman container checkpoint $cname
is "$output" $cname
Expand All @@ -134,6 +130,7 @@ function teardown() {
run_podman rm -t 0 -f $ctrID $cname
}

# bats test_tags=ci:parallel
@test "podman checkpoint --export, with volumes" {
skip_if_remote "Test uses --root/--runroot, which are N/A over remote"

Expand All @@ -143,12 +140,13 @@ function teardown() {
run_podman $p_opts load -i $PODMAN_TMPDIR/image.tar

# Create a volume, find unused network port, and create a webserv container
run_podman $p_opts volume create myvol
local cname=c_$(random_string 10)
volname=v-$(safename)
run_podman $p_opts volume create $volname
local cname=c-$(safename)
local host_port=$(random_free_port)
local server=http://127.0.0.1:$host_port

run_podman $p_opts run -d --name $cname --volume myvol:/myvol \
run_podman $p_opts run -d --name $cname --volume $volname:/myvol \
-p $host_port:80 \
-w /myvol \
$IMAGE sh -c "/bin/busybox-extras httpd -p 80;echo $cname >cname;echo READY;while :;do cat /proc/uptime >mydate.tmp;mv -f mydate.tmp mydate;sleep 0.1;done"
Expand Down Expand Up @@ -192,11 +190,12 @@ function teardown() {
is "$output" "$cname" "volume transferred fine"

run_podman rm -t 0 -f $cid
run_podman volume rm -f myvol
run_podman volume rm -f $volname
}

# FIXME: test --leave-running

# bats test_tags=ci:parallel
@test "podman checkpoint --file-locks" {
action='flock test.lock sh -c "while [ -e /wait ];do sleep 0.5;done;for i in 1 2 3;do echo \$i;sleep 0.5;done"'
run_podman run -d $IMAGE sh -c "touch /wait; touch test.lock; echo READY; $action & $action & wait"
Expand Down Expand Up @@ -232,10 +231,11 @@ function teardown() {
run_podman rm $cid
}

# bats test_tags=ci:parallel
@test "podman checkpoint/restore ip and mac handling" {
# Refer to https://github.com/containers/podman/issues/16666#issuecomment-1337860545
# for the correct behavior, this should cover all cases listed there.
local netname=net-$(random_string)
local netname="net-$(safename)"
local subnet="$(random_rfc1918_subnet)"
run_podman network create --subnet "$subnet.0/24" $netname

Expand Down Expand Up @@ -319,7 +319,8 @@ function teardown() {
# now restore it again but with --name this time, it should not keep the
# mac and ip to allow restoring the same container with different names
# at the same time
run_podman container restore --import "$archive" --name "newcon"
newname="newc-$(safename)"
run_podman container restore --import "$archive" --name $newname
cid="$output"

run_podman inspect $cid --format "{{(index .NetworkSettings.Networks \"$netname\").IPAddress}}"
Expand Down Expand Up @@ -422,6 +423,7 @@ function teardown() {
}

# rhbz#2177611 : podman breaks checkpoint/restore
# CANNOT BE PARALLELIZED: --latest
@test "podman checkpoint/restore the latest container" {
skip_if_remote "podman-remote does not support --latest option"
# checkpoint/restore -l must print the IDs
Expand Down

1 comment on commit 2cbb2e8

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.