Commit b2792b75 authored by Xavier Thompson's avatar Xavier Thompson

software/theia: Improve resiliency tests

parent 0a468034
......@@ -160,6 +160,19 @@ class ResilienceMixin(object):
class ExportAndImportMixin(object):
@classmethod
def setUpClass(cls):
super(ExportAndImportMixin, cls).setUpClass()
cls.theia_resiliency_logs = []
def fail(self, *args):
for log in self.theia_resiliency_logs:
print(log)
super(ExportAndImportMixin, self).fail(*args)
def tearDown(self):
self.theia_resiliency_logs.clear()
def getExportExitfile(self):
return self.getPartitionPath('export', 'srv', 'export-exitcode-file')
......@@ -212,7 +225,8 @@ class ExportAndImportMixin(object):
# Call export script manually
theia_export_script = self.getPartitionPath('export', 'bin', 'theia-export-script')
subprocess.check_call((theia_export_script,), stderr=subprocess.STDOUT)
out = subprocess.check_output((theia_export_script,), stderr=subprocess.STDOUT)
self.theia_resiliency_logs.append(out)
# Check that the export exitcode file was modified
self.assertGreater(os.path.getmtime(exitfile), initial_exitdate)
......@@ -236,7 +250,8 @@ class ExportAndImportMixin(object):
# Call the import script manually
theia_import_script = self.getPartitionPath('import', 'bin', 'theia-import-script')
subprocess.check_call((theia_import_script,), stderr=subprocess.STDOUT)
out = subprocess.check_output((theia_import_script,), stderr=subprocess.STDOUT)
self.theia_resiliency_logs.append(out)
# Check that the import exitcode file was updated
self.assertGreater(os.path.getmtime(exitfile), initial_exitdate)
......@@ -566,7 +581,7 @@ class TheiaSyncMixin(TakeoverMixin, ResilienceMixin):
# XXX Accelerate cron frequency instead ?
exporter_script = self.getPartitionPath('export', 'bin', 'exporter')
transaction_id = str(int(time.time()))
subprocess.check_call((exporter_script, '--transaction-id', transaction_id))
subprocess.check_output((exporter_script, '--transaction-id', transaction_id))
takeover_url, _ = self._getTakeoverUrlAndPassword()
......
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