From b64d99f1e9f7dc625bb814135283bfa62088014a Mon Sep 17 00:00:00 2001 From: Juha Kosonen Date: Fri, 26 Jan 2018 12:37:57 +0200 Subject: Refactor rally report generation - statistic data based on Rally results report - fix statistics calculations - use PrettyTable in generating the report Change-Id: Ic84adc5e30d446aea1f3045ba997c3ddf895e9f5 Signed-off-by: Juha Kosonen --- functest/tests/unit/openstack/rally/test_rally.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'functest/tests/unit/openstack/rally') diff --git a/functest/tests/unit/openstack/rally/test_rally.py b/functest/tests/unit/openstack/rally/test_rally.py index f4858527..ba8a241f 100644 --- a/functest/tests/unit/openstack/rally/test_rally.py +++ b/functest/tests/unit/openstack/rally/test_rally.py @@ -220,7 +220,7 @@ class OSRallyTesting(unittest.TestCase): @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' '_build_task_args', return_value={}) @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' - '_get_output') + '_append_summary') @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' 'get_task_id', return_value=None) @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' @@ -242,7 +242,7 @@ class OSRallyTesting(unittest.TestCase): @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' '_build_task_args', return_value={}) @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' - '_get_output') + '_append_summary') @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' 'get_task_id', return_value='1') @mock.patch('functest.opnfv_tests.openstack.rally.rally.RallyBase.' @@ -424,6 +424,16 @@ class OSRallyTesting(unittest.TestCase): self.assertEqual(self.rally_base.run(), testcase.TestCase.EX_RUN_ERROR) mock_prep_env.assert_called() + def test_append_summary(self): + text = '[{"result":[{"error":[]},{"error":["err"]}],' \ + '"full_duration": 17.312026}]' + self.rally_base._append_summary(text, "foo_test") + self.assertEqual(self.rally_base.summary[0]['test_name'], "foo_test") + self.assertEqual(self.rally_base.summary[0]['overall_duration'], + 17.312026) + self.assertEqual(self.rally_base.summary[0]['nb_tests'], 2) + self.assertEqual(self.rally_base.summary[0]['nb_success'], 1) + if __name__ == "__main__": logging.disable(logging.CRITICAL) -- cgit 1.2.3-korg