Bugfix: KeyError when tempest_custom runs wrong 37/33737/1
authorxudan <xudan16@huawei.com>
Tue, 25 Apr 2017 03:41:41 +0000 (03:41 +0000)
committerxudan <xudan16@huawei.com>
Tue, 25 Apr 2017 03:41:41 +0000 (03:41 +0000)
JIRA: DOVETAIL-406

1. When there are something wrong with the test case tempest_custom,
   it's details json data are "details": {}, So it will throw KeyError
   exception in this situation.
2. Catch this exception and set all sub_testcases FAIL.
3. Disable the exceed_max_retry_times().

Change-Id: I6bdfc5944a535625b2211a3bd8096a13b81b339e
Signed-off-by: xudan <xudan16@huawei.com>
dovetail/report.py
dovetail/run.py

index c51ce68..2c6200d 100644 (file)
@@ -416,16 +416,20 @@ class FunctestChecker(object):
         testcase_passed = 'SKIP'
         for sub_testcase in sub_testcase_list:
             self.logger.debug('check sub_testcase:%s', sub_testcase)
-            if self.get_sub_testcase(sub_testcase,
-                                     db_result['details']['errors']):
+            try:
+                if self.get_sub_testcase(sub_testcase,
+                                         db_result['details']['errors']):
+                    testcase.sub_testcase_passed(sub_testcase, 'FAIL')
+                    testcase_passed = 'FAIL'
+                    continue
+                if self.get_sub_testcase(sub_testcase,
+                                         db_result['details']['skipped']):
+                    testcase.sub_testcase_passed(sub_testcase, 'SKIP')
+                else:
+                    testcase.sub_testcase_passed(sub_testcase, 'PASS')
+            except KeyError:
                 testcase.sub_testcase_passed(sub_testcase, 'FAIL')
                 testcase_passed = 'FAIL'
-                continue
-            if self.get_sub_testcase(sub_testcase,
-                                     db_result['details']['skipped']):
-                testcase.sub_testcase_passed(sub_testcase, 'SKIP')
-            else:
-                testcase.sub_testcase_passed(sub_testcase, 'PASS')
 
         if testcase_passed == 'SKIP':
             for sub_testcase in sub_testcase_list:
index f268f92..607e1b1 100755 (executable)
@@ -54,8 +54,8 @@ def run_test(testsuite, testarea, logger):
             continue
         run_testcase = True
 
-        if testcase.exceed_max_retry_times():
-            run_testcase = False
+        if testcase.exceed_max_retry_times():
+        #    run_testcase = False
 
         # if testcase.script_result_acquired():
         #    run_testcase = False