Ignore connection error when testing load balancer

In the integration test with Neutron Load Balancer, we sometimes fail to
connect to the Load Balancer when testing that the stack deployed
successfully. Let's ignore those errors so that we retry for a bit in
case it takes some time to be deployed.

Change-Id: Ic97bd83fe56dc52fb49848d93e40cb57d1550a1f
Closes-Bug: #1545587
(cherry picked from commit df73c1c798)
This commit is contained in:
Thomas Herve 2016-02-18 13:15:37 +01:00 committed by Sergey Kraynev
parent 9452565018
commit 3bdcd6e2ce
1 changed files with 6 additions and 2 deletions

View File

@ -37,8 +37,12 @@ class AutoscalingLoadBalancerTest(scenario_base.ScenarioTestsBase):
resp = set()
for count in range(retries):
time.sleep(1)
r = requests.get(url, verify=self.verify_cert)
# skip unsuccessfull requests
try:
r = requests.get(url, verify=self.verify_cert)
except requests.exceptions.ConnectionError:
# The LB may not be up yet, let's retry
continue
# skip unsuccessful requests
if r.status_code == 200:
resp.add(r.text)
self.assertEqual(expected_num, len(resp))