From 6d33ad294d6bc56226c86604cded0b70a6952661 Mon Sep 17 00:00:00 2001 From: xudan Date: Tue, 27 Aug 2019 23:26:24 -0400 Subject: Add portal_key_file into all test case yml files Change-Id: If111a8cc56c31ec3e22b090aca92ff56d41f7e01 Signed-off-by: xudan --- dovetail/report.py | 2 ++ dovetail/testcase.py | 3 +++ dovetail/tests/unit/test_report.py | 9 +++++++++ dovetail/tests/unit/test_testcase.py | 7 +++++++ dovetail/tests/unit/test_testcase.yaml | 1 + 5 files changed, 22 insertions(+) (limited to 'dovetail') diff --git a/dovetail/report.py b/dovetail/report.py index 643f7db2..25c34a29 100644 --- a/dovetail/report.py +++ b/dovetail/report.py @@ -119,6 +119,7 @@ class Report(object): testcase_inreport['objective'] = '' testcase_inreport['sub_testcase'] = [] testcase_inreport['mandatory'] = False + testcase_inreport['portal_key_file'] = '' report_obj['testcases_list'].append(testcase_inreport) continue @@ -132,6 +133,7 @@ class Report(object): report_obj['vnf_type'] = vnf_type report_obj['vnf_checksum'] = self.get_checksum(vnf_type) testcase_inreport['mandatory'] = testcase.is_mandatory + testcase_inreport['portal_key_file'] = testcase.portal_key_file() testcase_inreport['sub_testcase'] = [] if testcase.sub_testcase() is not None: for sub_test in testcase.sub_testcase(): diff --git a/dovetail/testcase.py b/dovetail/testcase.py index deb00250..3856b137 100644 --- a/dovetail/testcase.py +++ b/dovetail/testcase.py @@ -89,6 +89,9 @@ class Testcase(object): def validate_testcase(self): return self.testcase['validate']['testcase'] + def portal_key_file(self): + return self.testcase['report']['portal_key_file'] + def increase_retry(self): return self._increase_retry(self.validate_testcase()) diff --git a/dovetail/tests/unit/test_report.py b/dovetail/tests/unit/test_report.py index 84bd1f38..f7f8adc8 100644 --- a/dovetail/tests/unit/test_report.py +++ b/dovetail/tests/unit/test_report.py @@ -195,6 +195,7 @@ class ReportTesting(unittest.TestCase): testcase_obj.objective.return_value = 'objective' mock_checksum.return_value = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' testcase_obj.is_mandatory = True + testcase_obj.portal_key_file.return_value = 'a/b.log' testcase_obj.vnf_type.return_value = 'tosca' testcase_obj.sub_testcase.return_value = ['subt_a'] testcase_obj.sub_testcase_passed.return_value = 'PASS' @@ -215,6 +216,7 @@ class ReportTesting(unittest.TestCase): 'result': 'PASS', 'objective': 'objective', 'mandatory': True, + 'portal_key_file': 'a/b.log', 'sub_testcase': [{ 'name': 'subt_a', 'result': 'PASS' @@ -225,6 +227,7 @@ class ReportTesting(unittest.TestCase): 'result': 'Undefined', 'objective': '', 'mandatory': False, + 'portal_key_file': '', 'sub_testcase': [] } ] @@ -256,6 +259,7 @@ class ReportTesting(unittest.TestCase): testcase_obj.objective.return_value = 'objective' testcase_obj.is_mandatory = True testcase_obj.vnf_type.return_value = None + testcase_obj.portal_key_file.return_value = 'a/b.log' testcase_obj.sub_testcase.return_value = ['subt_a'] testcase_obj.sub_testcase_passed.return_value = 'PASS' mock_testcase.get.side_effect = [testcase_obj, None] @@ -273,6 +277,7 @@ class ReportTesting(unittest.TestCase): 'result': 'PASS', 'objective': 'objective', 'mandatory': True, + 'portal_key_file': 'a/b.log', 'sub_testcase': [{ 'name': 'subt_a', 'result': 'PASS' @@ -283,6 +288,7 @@ class ReportTesting(unittest.TestCase): 'result': 'Undefined', 'objective': '', 'mandatory': False, + 'portal_key_file': '', 'sub_testcase': [] } ] @@ -313,6 +319,7 @@ class ReportTesting(unittest.TestCase): testcase_obj.passed.return_value = 'PASS' testcase_obj.objective.return_value = 'objective' testcase_obj.is_mandatory = True + testcase_obj.portal_key_file.return_value = 'a/b.log' testcase_obj.vnf_type.side_effect = Exception() testcase_obj.sub_testcase.return_value = ['subt_a'] testcase_obj.sub_testcase_passed.return_value = 'PASS' @@ -331,6 +338,7 @@ class ReportTesting(unittest.TestCase): 'result': 'PASS', 'objective': 'objective', 'mandatory': True, + 'portal_key_file': 'a/b.log', 'sub_testcase': [{ 'name': 'subt_a', 'result': 'PASS' @@ -341,6 +349,7 @@ class ReportTesting(unittest.TestCase): 'result': 'Undefined', 'objective': '', 'mandatory': False, + 'portal_key_file': '', 'sub_testcase': [] } ] diff --git a/dovetail/tests/unit/test_testcase.py b/dovetail/tests/unit/test_testcase.py index 06a23025..5f4f15d9 100644 --- a/dovetail/tests/unit/test_testcase.py +++ b/dovetail/tests/unit/test_testcase.py @@ -161,6 +161,13 @@ class TestcaseTesting(unittest.TestCase): self.assertEquals('tempest_smoke_serial', result) + def test_portal_key_file(self): + testcase = tcase.Testcase(self.testcase_yaml) + + result = testcase.portal_key_file() + + self.assertEquals('tempest_logs/tempest_smoke_serial.html', result) + def test_vnf_type(self): testcase = tcase.OnapVtpTestcase(self.testcase_yaml) diff --git a/dovetail/tests/unit/test_testcase.yaml b/dovetail/tests/unit/test_testcase.yaml index eac0421c..b4cd3b1d 100644 --- a/dovetail/tests/unit/test_testcase.yaml +++ b/dovetail/tests/unit/test_testcase.yaml @@ -16,6 +16,7 @@ dovetail.ipv6.tc001: type: functest testcase: tempest_smoke_serial report: + portal_key_file: tempest_logs/tempest_smoke_serial.html sub_testcase_list: - tempest.api.network.test_networks.BulkNetworkOpsIpV6Test.test_bulk_create_delete_network - tempest.api.network.test_networks.BulkNetworkOpsIpV7Test.test_bulk_create_delete_port -- cgit 1.2.3-korg