Commit fd6884a6 authored by Benjamin Blanc's avatar Benjamin Blanc

scalability: runScalabilityTestSuite: Add while/try in getConnection

parent 8b1ee8ef
...@@ -19,7 +19,9 @@ from erp5.util import taskdistribution ...@@ -19,7 +19,9 @@ from erp5.util import taskdistribution
from erp5.util.testnode import Utils from erp5.util.testnode import Utils
def getConnection(erp5_url): def getConnection(erp5_url, log):
while True:
try:
parsed = urlparse.urlparse(erp5_url) parsed = urlparse.urlparse(erp5_url)
host = "%s:%s" % (parsed.hostname, str(parsed.port)) host = "%s:%s" % (parsed.hostname, str(parsed.port))
if parsed.scheme == 'https': if parsed.scheme == 'https':
...@@ -28,12 +30,16 @@ def getConnection(erp5_url): ...@@ -28,12 +30,16 @@ def getConnection(erp5_url):
return httplib.HTTPConnection(host) return httplib.HTTPConnection(host)
else: else:
raise ValueError("Protocol not implemented") raise ValueError("Protocol not implemented")
except:
log("Can't get connecttion to %s, we will retry." %erp5_url)
time.sleep(10)
pass
MAX_INSTALLATION_TIME = 1200 MAX_INSTALLATION_TIME = 1200
def waitFor0PendingActivities(erp5_url): def waitFor0PendingActivities(erp5_url, log):
start_time = time.time() start_time = time.time()
while MAX_INSTALLATION_TIME > time.time()-start_time: while MAX_INSTALLATION_TIME > time.time()-start_time:
zope_connection = getConnection(erp5_url) zope_connection = getConnection(erp5_url, log)
zope_connection.request( zope_connection.request(
'GET', '/erp5/portal_activities/getMessageList', 'GET', '/erp5/portal_activities/getMessageList',
headers=header_dict headers=header_dict
...@@ -285,7 +291,7 @@ class ScalabilityLauncher(object): ...@@ -285,7 +291,7 @@ class ScalabilityLauncher(object):
error_count = 1 error_count = 1
# Waiting for 0-pending activities # Waiting for 0-pending activities
waitFor0PendingActivities(self.__argumentNamespace.erp5_url) waitFor0PendingActivities(self.__argumentNamespace.erp5_url, self.log)
# Here call a runScalabilityTest ( placed on product/ERP5Type/tests ) ? # Here call a runScalabilityTest ( placed on product/ERP5Type/tests ) ?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment