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 952cec9
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/integration/kill.bats
Original file line number Diff line number Diff line change
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 @@ -58,11 +59,16 @@ test_host_pidns_kill() {

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
# 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 952cec9

Please sign in to comment.