Commit 26c5ef0b authored by Nicolas Wavrant's avatar Nicolas Wavrant

resiliencytest: adds tests on services status after takover for the slaprunner

parent 1bec3073
Pipeline #3978 skipped
...@@ -233,6 +233,20 @@ class SlaprunnerTestSuite(ResiliencyTestSuite): ...@@ -233,6 +233,20 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
self.data = self._retrieveInstanceLogFile() self.data = self._retrieveInstanceLogFile()
def _checkServicesAreRunning(self):
self.logger.info('Checking that processes are correctly started')
import lxml.html
service_status = json.loads(self._connectToSlaprunner('supervisordStatus'))
status_table = service_status['result']
table = lxml.html.fromstring(status_table)
status_list = table.xpath('//a[@class=\'supervisor-process-status\']')
for element in status_list:
if element.text == 'STOPPED':
self.logger.info("Some processes are 'STOPPED' : failure.")
return False
return True
def checkDataOnCloneInstance(self): def checkDataOnCloneInstance(self):
""" """
Check that: Check that:
...@@ -240,6 +254,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite): ...@@ -240,6 +254,7 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
* Software Release profile is the same, * Software Release profile is the same,
* Software Release is built and is the same, (?) * Software Release is built and is the same, (?)
* Instance is deployed and is the same. * Instance is deployed and is the same.
* Services are started
""" """
# XXX: does the promise wait for the software to be built and the instance to be ready? # XXX: does the promise wait for the software to be built and the instance to be ready?
old_slaprunner_backend_url = self.slaprunner_backend_url old_slaprunner_backend_url = self.slaprunner_backend_url
...@@ -255,9 +270,11 @@ class SlaprunnerTestSuite(ResiliencyTestSuite): ...@@ -255,9 +270,11 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
if new_data == self.data: if new_data == self.data:
self.logger.info('Data are the same: success.') self.logger.info('Data are the same: success.')
return True
else: else:
self.logger.info('Data are different: failure.') self.logger.info('Data are different: failure.')
return False
return self._checkServicesAreRunning():
def runTestSuite(*args, **kwargs): def runTestSuite(*args, **kwargs):
......
...@@ -208,7 +208,7 @@ def supervisordStatus(): ...@@ -208,7 +208,7 @@ def supervisordStatus():
for item in result: for item in result:
html += "<tr>" html += "<tr>"
html += "<td class='first'><b><a href='" + url_for('tailProcess', process=item[0]) + "'>" + item[0] + "</a></b></td>" html += "<td class='first'><b><a href='" + url_for('tailProcess', process=item[0]) + "'>" + item[0] + "</a></b></td>"
html += "<td align='center'><a href='" + url_for('startStopProccess', process=item[0], action=item[1]) + "'>" + item[1] + "</a></td>" html += "<td align='center'><a class='supervisor-process-status' href='" + url_for('startStopProccess', process=item[0], action=item[1]) + "'>" + item[1] + "</a></td>"
html += "<td align='center'>" + item[3] + "</td><td>" + item[5] + "</td>" html += "<td align='center'>" + item[3] + "</td><td>" + item[5] + "</td>"
html += "<td align='center'><a href='" + url_for('startStopProccess', process=item[0], action='RESTART') + "'>Restart</a></td>" html += "<td align='center'><a href='" + url_for('startStopProccess', process=item[0], action='RESTART') + "'>Restart</a></td>"
html += "</tr>" html += "</tr>"
......
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