aboutsummaryrefslogtreecommitdiffstats
path: root/functest/tests/unit
diff options
context:
space:
mode:
authorJuha Kosonen <juha.kosonen@nokia.com>2018-01-26 12:37:57 +0200
committerJuha Kosonen <juha.kosonen@nokia.com>2018-01-26 12:41:44 +0200
commitb64d99f1e9f7dc625bb814135283bfa62088014a (patch)
tree981799cd0b93f5c5c6c34ffd851f05ee0264a7cd /functest/tests/unit
parentf45b6411560bdc21b78346889a0e051cac48efb5 (diff)
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 <juha.kosonen@nokia.com>
Diffstat (limited to 'functest/tests/unit')
-rw-r--r--functest/tests/unit/openstack/rally/test_rally.py14
1 files changed, 12 insertions, 2 deletions
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)