Commit ccb3c362 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

resiliencytest: no need to edit haproxy config of ERP5

After the testnodes were upgraded to have much shorter path names, the
socket path is already short enough.
parent 55f21858
...@@ -77,49 +77,6 @@ class ERP5TestSuite(SlaprunnerTestSuite): ...@@ -77,49 +77,6 @@ class ERP5TestSuite(SlaprunnerTestSuite):
self.logger.info('Retrieved erp5 password is:\n%s' % password) self.logger.info('Retrieved erp5 password is:\n%s' % password)
return password return password
def _getSlaprunnerServiceInformationList(self):
result = self._connectToSlaprunner(
resource='/inspectInstance',
)
return json.loads(result)
def _editHAProxyconfiguration(self):
"""
XXX pure hack.
haproxy processes don't support long path for sockets.
Edit haproxy configuration file of erp5 to make it compatible with long paths
Then restart haproxy.
"""
self.logger.info('Editing HAProxy configuration...')
service_information_list = self._getSlaprunnerServiceInformationList()
# We expect only one service haproxy
haproxy_service, = [
x['service_name'] for x in service_information_list
if 'haproxy' in x['service_name']
]
haproxy_slappart = haproxy_service.split(':', 1)[0]
result = self._connectToSlaprunner(
resource='/getFileContent',
data='file=runner_workdir%2Finstance%2F{slappart}%2Fetc%2Fhaproxy.cfg'.format(slappart=haproxy_slappart)
)
file_content = json.loads(result)['result']
file_content = file_content.replace('var/run/haproxy.sock', 'ha.sock')
self._connectToSlaprunner(
resource='/saveFileContent',
data='file=runner_workdir%%2Finstance%%2F%s%%2Fetc%%2Fhaproxy.cfg&content=%s' % (
haproxy_slappart,
quote(file_content),
)
)
# Restart HAProxy
self._connectToSlaprunner(
resource='/startStopProccess/name/%s:*/cmd/RESTART' % haproxy_slappart
)
def _getCreatedERP5Document(self): def _getCreatedERP5Document(self):
""" Fetch and return content of ERP5 document created above.""" """ Fetch and return content of ERP5 document created above."""
url = "%s/erp5/getTitle" % self._getERP5Url() url = "%s/erp5/getTitle" % self._getERP5Url()
...@@ -130,7 +87,6 @@ class ERP5TestSuite(SlaprunnerTestSuite): ...@@ -130,7 +87,6 @@ class ERP5TestSuite(SlaprunnerTestSuite):
url = "%s/erp5/getId" % self._getERP5Url() url = "%s/erp5/getId" % self._getERP5Url()
return self._connectToERP5(url) return self._connectToERP5(url)
def _connectToERP5(self, url, data=None, password=None): def _connectToERP5(self, url, data=None, password=None):
if password is None: if password is None:
password = self._getERP5Password() password = self._getERP5Password()
...@@ -202,8 +158,6 @@ class ERP5TestSuite(SlaprunnerTestSuite): ...@@ -202,8 +158,6 @@ class ERP5TestSuite(SlaprunnerTestSuite):
self._deployInstance() self._deployInstance()
self._deployInstance() self._deployInstance()
self._editHAProxyconfiguration()
time.sleep(30) time.sleep(30)
self.logger.info('Starting all partitions ...') self.logger.info('Starting all partitions ...')
self._connectToSlaprunner('/startAllPartition') self._connectToSlaprunner('/startAllPartition')
...@@ -250,8 +204,6 @@ class ERP5TestSuite(SlaprunnerTestSuite): ...@@ -250,8 +204,6 @@ class ERP5TestSuite(SlaprunnerTestSuite):
self._deployInstance() self._deployInstance()
time.sleep(60) time.sleep(60)
self._editHAProxyconfiguration()
time.sleep(60)
new_data = self._getCreatedERP5Document() new_data = self._getCreatedERP5Document()
if new_data == self.data: if new_data == self.data:
......
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