summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMike Heald <mike.heald@hp.com>2014-09-12 13:50:57 +0100
committerMike Heald <mike.heald@hp.com>2014-09-12 15:43:54 +0100
commit22a68b4c25d6b10f53756b419e493995aefc2f2f (patch)
tree812c9192f254185f060c389fe7fa4995d09d280f /tools
parent4cecec5c788d78132f78c90d070a9ac5709d0884 (diff)
downloadpbr-22a68b4c25d6b10f53756b419e493995aefc2f2f.tar.gz
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
Diffstat (limited to 'tools')
-rw-r--r--tools/integration.sh22
1 files changed, 19 insertions, 3 deletions
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 <<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