Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

tests: Retry rm'ing container #2047

Merged
merged 1 commit into from
Aug 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion tests/tox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,17 @@ bash "$WORKSPACE"/travis-builds/purge_cluster.sh
containers_to_remove=$(docker ps -a -q)

if [ "${containers_to_remove}" ]; then
docker rm -f "$@" "${containers_to_remove}" || echo failed to remove containers
ATTEMPTS=0
NUM_CONTAINERS=$(docker ps -a -q | wc -l)
until [ "$ATTEMPTS" -eq 5 ] || [ "$NUM_CONTAINERS" -eq 0 ]; do
docker rm -f "$@" "${containers_to_remove}"
((ATTEMPTS++))
NUM_CONTAINERS=$(docker ps -a -q | wc -l)
done
if [ "$ATTEMPTS" -eq 5 ]; then
echo "Removing containers failed"
exit 1
fi
fi

cd "$WORKSPACE"
Expand Down