← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~chad.smith/cloud-init:tests/cii-summary-fallback-to-traceback into cloud-init:master

 

Chad Smith has proposed merging ~chad.smith/cloud-init:tests/cii-summary-fallback-to-traceback into cloud-init:master.

Commit message:
tests: integration test failure summary to use traceback if empty error

When integration tests verification fails the failure object returned
contains has 'error' and 'traceback' keys each which can contain empty
strings. If the simplified 'error' message is empty, fallback and use
the more verbose full 'traceback' text in the failure summary.

Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1797199 in cloud-init: "kvm integration test failures due to invalid config-disk path"
  https://bugs.launchpad.net/cloud-init/+bug/1797199

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/356427
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:tests/cii-summary-fallback-to-traceback into cloud-init:master.
diff --git a/tests/cloud_tests/testcases/base.py b/tests/cloud_tests/testcases/base.py
index 16b268e..bbd80ae 100644
--- a/tests/cloud_tests/testcases/base.py
+++ b/tests/cloud_tests/testcases/base.py
@@ -262,7 +262,10 @@ class CloudTestCase(unittest2.TestCase):
         self.assertItemsEqual([], instance_data['base64_encoded_keys'])
         self.assertEqual('unknown', v1_data['cloud_name'])
         self.assertEqual('nocloud', v1_data['platform'])
-        self.assertEqual('config-disk (/dev/vda)', v1_data['subplatform'])
+        subplatform = v1_data['subplatform']
+        self.assertIsNotNone(
+            re.match(r'config-disk \(\/dev\/[a-z]{3}\)', subplatform),
+            'kvm subplatform "%s" != "config-disk (/dev/...)"' % subplatform)
         self.assertIsNone(
             v1_data['availability_zone'],
             'found unexpected kvm availability_zone %s' %
diff --git a/tests/cloud_tests/verify.py b/tests/cloud_tests/verify.py
index 9911ecf..7018f4d 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)
 
 

Follow ups