Skip to content

Commit

Permalink
test: add retry for killing container with host pidns
Browse files Browse the repository at this point in the history
Signed-off-by: lifubang <lifubang@acmcoder.com>
  • Loading branch information
lifubang committed Jan 7, 2024
1 parent c255024 commit c9fd3bd
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/integration/kill.bats
Expand Up @@ -46,6 +46,7 @@ test_host_pidns_kill() {
# kills the container; see "kill KILL [host pidns + init gone]"
# below).
kill -9 "$init_pid"
wait_for_container 10 1 test_busybox stopped
fi

# Get the list of all container processes.
Expand All @@ -56,13 +57,18 @@ test_host_pidns_kill() {
kill -0 "$p"
done

runc kill test_busybox KILL
[ "$status" -eq 0 ]
wait_for_container 10 1 test_busybox stopped

# Make sure all processes are gone.
pids=$(cat "$cgpath"/cgroup.procs) || true # OK if cgroup is gone
echo "pids: $pids"
retry=0
while [ $retry -lt 10 ] && [ -n "$pids" ]; do
runc kill test_busybox KILL
[ "$status" -eq 0 ]

# Make sure all processes are gone.
pids=$(cat "$cgpath"/cgroup.procs) || true # OK if cgroup is gone
echo "pids: $pids"
if [ -n "$pids" ]; then
retry=$((retry + 1))
fi
done
[ -z "$pids" ]
}

Expand Down

0 comments on commit c9fd3bd

Please sign in to comment.