Commit 296ad8e6 authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Łukasz Nowak

caddy-frontend/test: Provide more information in case of plugin failure

parent e381c05b
...@@ -364,6 +364,7 @@ class TestDataMixin(object): ...@@ -364,6 +364,7 @@ class TestDataMixin(object):
self.software_path, 'bin', 'monitor.runpromise') self.software_path, 'bin', 'monitor.runpromise')
partition_path_list = glob.glob(os.path.join(self.instance_path, '*')) partition_path_list = glob.glob(os.path.join(self.instance_path, '*'))
promise_status_list = [] promise_status_list = []
msg = []
for partition_path in sorted(partition_path_list): for partition_path in sorted(partition_path_list):
plugin_path_list = sorted(glob.glob( plugin_path_list = sorted(glob.glob(
os.path.join(partition_path, 'etc', 'plugin', '*.py') os.path.join(partition_path, 'etc', 'plugin', '*.py')
...@@ -379,15 +380,21 @@ class TestDataMixin(object): ...@@ -379,15 +380,21 @@ class TestDataMixin(object):
'-c', monitor_conf, '-c', monitor_conf,
'--run-only', plugin '--run-only', plugin
]) ])
if plugin_status == 1:
msg.append(plugin_result)
# sanity check # sanity check
if 'Checking promise %s' % plugin not in plugin_result: if 'Checking promise %s' % plugin not in plugin_result:
plugin_status = 1 plugin_status = 1
msg.append(plugin_result)
promise_status_list.append( promise_status_list.append(
'%s: %s' % ( '%s: %s' % (
plugin_path[len(self.instance_path) + 1:], plugin_path[len(self.instance_path) + 1:],
plugin_status == 0 and 'OK' or 'ERROR')) plugin_status == 0 and 'OK' or 'ERROR'))
self.assertTestData('\n'.join(promise_status_list)) if msg:
msg = ''.join(msg).strip()
self.assertTestData('\n'.join(promise_status_list), msg=(msg or None))
def test_promise_run_promise(self): def test_promise_run_promise(self):
partition_path_list = glob.glob(os.path.join(self.instance_path, '*')) partition_path_list = glob.glob(os.path.join(self.instance_path, '*'))
......
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