Skip to content

Commit

Permalink
Retry network removal when cleaning up before and after test runs.
Browse files Browse the repository at this point in the history
  • Loading branch information
toregge committed Oct 5, 2024
1 parent 86497e9 commit 34abe0a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions bin/run-tests-on-swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,16 @@ docker_cleanup() {
fi

if docker network inspect $NETWORK &> /dev/null; then
if ! docker network rm $NETWORK &> /dev/null; then
log_debug "Could not remove network $NETWORK"
else
retries=5
while test $retries -gt 0; do
if docker network rm $NETWORK &> /dev/null; then
break
fi
retries=$(($retries - 1))
log_debug "Could not remove network $NETWORK ($retries retries left)"
sleep 2
done
if test $retries -gt 0; then
while [[ -n $(docker network ls | grep "$NETWORK.*swarm") ]]; do
log_debug "Waiting for network $NETWORK to be removed."
sleep 2
Expand Down

0 comments on commit 34abe0a

Please sign in to comment.