Retry the integration setup on connection error

Sometimes there are network errors communicating with pypi
during a long running (1h+) integration gate job. This
causes the job to fail, and wastes a lot of time re-running
the job to get it to pass. This change makes it less likely
to fail, as if there is a timeout or socket error, the
integration setup will retry.

Change-Id: Ic4c888626699eb710e85e3bdc48dd6ee74bdf024
This commit is contained in:
Mike Heald 2014-09-12 13:50:57 +01:00
parent 4cecec5c78
commit 22a68b4c25
1 changed files with 19 additions and 3 deletions

View File

@ -55,9 +55,25 @@ EOF
cat <<EOF > setup.py
import setuptools
setuptools.setup(
setup_requires=['pbr'],
pbr=True)
try:
from requests import Timeout
except ImportError:
from pip._vendor.requests import Timeout
from socket import error as SocketError
# Some environments have network issues that drop connections to pypi
# when running integration tests, so we retry here so that hour-long
# test runs are less likely to fail randomly.
try:
setuptools.setup(
setup_requires=['pbr'],
pbr=True)
except (SocketError, Timeout):
setuptools.setup(
setup_requires=['pbr'],
pbr=True)
EOF
mkdir test_project