diff options
author | Chad Smith <chad.smith@canonical.com> | 2019-02-22 09:41:28 +0000 |
---|---|---|
committer | Server Team CI Bot <josh.powers+server-team-bot@canonical.com> | 2019-02-22 09:41:28 +0000 |
commit | e7a8f81e6eee390ce6920df053bf7467b5e4dbd7 (patch) | |
tree | 243590d03a0700718c8c931583f55cf33e4e7ad7 | |
parent | 9cf9d8cdd3a8fd7d4d425f7051122d0ac8af2bbd (diff) | |
download | vyos-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.
-rw-r--r-- | tests/cloud_tests/verify.py | 9 |
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) |