1
0
Fork 0

Fix the container_restart test

This might be a race condition
This commit is contained in:
Nicolas Duchon 2020-11-28 00:19:45 +01:00
parent f069d50d33
commit 5cfe0cb2d3
No known key found for this signature in database
GPG Key ID: EA3151C66A4D79E7

View File

@ -36,7 +36,6 @@ function cleanup {
trap cleanup EXIT
# Run a separate nginx container for each domain in the $domains array.
# Start all the containers in a row so that docker-gen debounce timers fire only once.
for domain in "${domains[@]}"; do
if docker run --rm -d \
--name "$domain" \
@ -50,21 +49,15 @@ for domain in "${domains[@]}"; do
else
echo "Could not start test web server for $domain"
fi
done
for domain in "${domains[@]}"; do
# Check if container restarted
timeout="$(date +%s)"
timeout="$((timeout + 120))"
timeout="$((timeout + 60))"
until grep "$domain" "${TRAVIS_BUILD_DIR}"/test/tests/container_restart/docker_event_out.txt; do
if [[ "$(date +%s)" -gt "$timeout" ]]; then
echo "Container $domain didn't restart in under two minute."
echo "Container $domain didn't restart in under one minute."
break
fi
sleep 0.1
done
# Stop the Nginx container silently.
docker stop "$domain" > /dev/null
done