From 26c2a8f2d556a8777d443b02d931e7df7fec8f6c Mon Sep 17 00:00:00 2001 From: zhihui wu Date: Fri, 2 Jun 2017 16:07:24 +0800 Subject: add system_info and condition to qpi report According to the part "system_info" and "condition" in spec, gather these data and add them to qpi report. Change-Id: I5efc996c2bfb34452e9aa323d8288c1dd2d8d276 Signed-off-by: zhihui wu --- .../plugins/action/calculate_test.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'tests/unit/ansible_library/plugins') diff --git a/tests/unit/ansible_library/plugins/action/calculate_test.py b/tests/unit/ansible_library/plugins/action/calculate_test.py index 80a07206..a83e1286 100644 --- a/tests/unit/ansible_library/plugins/action/calculate_test.py +++ b/tests/unit/ansible_library/plugins/action/calculate_test.py @@ -105,10 +105,25 @@ def section_result(metric_result): @pytest.fixture() -def qpi_result(section_result, metrics): +def info(): + return { + "system_info": { + "kernel": "4.4.0-72-generic x86_64 (64 bit)", + "product": "EC600G3", + "os": "Ubuntu 16.04 xenial", + "cpu": "2 Deca core Intel Xeon E5-2650 v3s (-HT-MCP-SMP-)", + "disk": "1200.3GB (25.1% used)", + "memory": "30769.7/128524.1MB" + } + } + + +@pytest.fixture() +def qpi_result(section_result, metrics, info): return {'score': 2048, 'name': 'compute', 'description': 'QTIP Performance Index of compute', + 'system_info': info, 'children': [section_result], 'details': { 'spec': "https://git.opnfv.org/qtip/tree/resources/QPI/compute.yaml", @@ -128,10 +143,10 @@ def test_calc_section(section_spec, metrics, section_baseline, section_result): section_baseline) == section_result -def test_calc_qpi(qpi_spec, metrics, qpi_baseline, qpi_result): +def test_calc_qpi(qpi_spec, metrics, qpi_baseline, info, qpi_result): assert calculate.calc_qpi(qpi_spec, metrics, - qpi_baseline) == qpi_result + qpi_baseline, info) == qpi_result @pytest.mark.parametrize('metrics, baseline, expected', [ -- cgit 1.2.3-korg