From 22a68b4c25d6b10f53756b419e493995aefc2f2f Mon Sep 17 00:00:00 2001 From: Mike Heald Date: Fri, 12 Sep 2014 13:50:57 +0100 Subject: 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 --- tools/integration.sh | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/integration.sh b/tools/integration.sh index 7d6038a..227aa4c 100644 --- a/tools/integration.sh +++ b/tools/integration.sh @@ -55,9 +55,25 @@ EOF cat < 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 -- cgit v1.2.1