Commit 470da70c authored by Guillaume Hervier's avatar Guillaume Hervier

resiliencytest.slaprunner: Add error log when contacting slaprunner.

/reviewed-on nexedi/slapos.toolbox!38
parent ed7f5603
...@@ -85,15 +85,19 @@ class SlaprunnerTestSuite(ResiliencyTestSuite): ...@@ -85,15 +85,19 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
Connect through HTTP to the slaprunner instance. Connect through HTTP to the slaprunner instance.
Require self.slaprunner_backend_url to be set. Require self.slaprunner_backend_url to be set.
""" """
url = "%s/%s" % (self.slaprunner_backend_url, resource) try:
if data: url = "%s/%s" % (self.slaprunner_backend_url, resource)
result = self._opener_director.open(url, data=data) if data:
else: result = self._opener_director.open(url, data=data)
result = self._opener_director.open(url) else:
result = self._opener_director.open(url)
if result.getcode() is not 200: if result.getcode() is not 200:
raise NotHttpOkException(result.getcode()) raise NotHttpOkException(result.getcode())
return result.read() return result.read()
except urllib2.HTTPError:
self.logger.error('Error when contacting slaprunner at URL: {}'.format(url))
raise
def _login(self): def _login(self):
self.logger.debug('Logging in...') self.logger.debug('Logging in...')
...@@ -208,7 +212,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite): ...@@ -208,7 +212,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
) )
data = json.loads(data) data = json.loads(data)
if data['code'] == 0: if data['code'] == 0:
self.logger.warning(data['result']) self.logger.warning(data['result'])
except (NotHttpOkException, urllib2.HTTPError): except (NotHttpOkException, urllib2.HTTPError):
# cloning can be very long. # cloning can be very long.
......
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