summaryrefslogtreecommitdiffstats
path: root/tests/unit/ansible_library/plugins/action/calculate_test.py
diff options
context:
space:
mode:
authorzhihui wu <wu.zhihui1@zte.com.cn>2017-06-02 16:07:24 +0800
committerzhihui wu <wu.zhihui1@zte.com.cn>2017-06-06 16:05:36 +0800
commit26c2a8f2d556a8777d443b02d931e7df7fec8f6c (patch)
treed93397cd1e3f01a1bbaa5d6b91c4140ec1a6f974 /tests/unit/ansible_library/plugins/action/calculate_test.py
parent995656837a0950ccadab7d2b87eded85072ba70e (diff)
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 <wu.zhihui1@zte.com.cn>
Diffstat (limited to 'tests/unit/ansible_library/plugins/action/calculate_test.py')
-rw-r--r--tests/unit/ansible_library/plugins/action/calculate_test.py21
1 files changed, 18 insertions, 3 deletions
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', [