summaryrefslogtreecommitdiff
path: root/tests/cloud_tests/verify.py
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2019-02-22 09:41:28 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2019-02-22 09:41:28 +0000
commite7a8f81e6eee390ce6920df053bf7467b5e4dbd7 (patch)
tree243590d03a0700718c8c931583f55cf33e4e7ad7 /tests/cloud_tests/verify.py
parent9cf9d8cdd3a8fd7d4d425f7051122d0ac8af2bbd (diff)
downloadvyos-cloud-init-e7a8f81e6eee390ce6920df053bf7467b5e4dbd7.tar.gz
vyos-cloud-init-e7a8f81e6eee390ce6920df053bf7467b5e4dbd7.zip
tests: integration test failure summary to use traceback if empty error
When integration tests verification fails, the object returned contains has 'error' and 'traceback' keys. Each key can contain empty strings. If the simplified 'error' message is empty, fallback and use the more verbose full 'traceback' text in the failure summary.
Diffstat (limited to 'tests/cloud_tests/verify.py')
-rw-r--r--tests/cloud_tests/verify.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/cloud_tests/verify.py b/tests/cloud_tests/verify.py
index 9911ecf2..7018f4d5 100644
--- a/tests/cloud_tests/verify.py
+++ b/tests/cloud_tests/verify.py
@@ -61,12 +61,17 @@ def format_test_failures(test_result):
if not test_result['failures']:
return ''
failure_hdr = ' test failures:'
- failure_fmt = ' * {module}.{class}.{function}\n {error}'
+ failure_fmt = ' * {module}.{class}.{function}\n '
output = []
for failure in test_result['failures']:
if not output:
output = [failure_hdr]
- output.append(failure_fmt.format(**failure))
+ msg = failure_fmt.format(**failure)
+ if failure.get('error'):
+ msg += failure['error']
+ else:
+ msg += failure.get('traceback', '')
+ output.append(msg)
return '\n'.join(output)