aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorYujun Zhang <zhang.yujunz@zte.com.cn>2017-09-04 02:44:43 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-09-04 02:44:43 +0000
commit9ac9231cf1876719ca15f681a8fae667343a8c77 (patch)
tree8d48258b411a403b38a32259344b080dbdb27317 /tests/unit
parent028cef6600399cae4ce6d252a03d6cfb691d43f0 (diff)
parentf0ecce090026da3ede406289d139d1de08674134 (diff)
Merge changes from topic 'storage'
* changes: Keep tests/data consistent with repository structure Add score calculation module for storperf
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/loader/qpi_test.py8
-rw-r--r--tests/unit/score_test.py21
2 files changed, 25 insertions, 4 deletions
diff --git a/tests/unit/loader/qpi_test.py b/tests/unit/loader/qpi_test.py
index b53030d4..7fc8ce29 100644
--- a/tests/unit/loader/qpi_test.py
+++ b/tests/unit/loader/qpi_test.py
@@ -16,8 +16,8 @@ QPI_SPEC = 'compute.yaml'
@pytest.fixture()
-def qpi_spec(benchmarks_root):
- return QPISpec('compute.yaml', paths=[benchmarks_root])
+def qpi_spec(resources_root):
+ return QPISpec('compute.yaml', paths=[resources_root])
def test_init(qpi_spec):
@@ -29,8 +29,8 @@ def test_init(qpi_spec):
in str(excinfo.value)
-def test_list_all(benchmarks_root):
- qpi_spec_list = list(QPISpec.list_all(paths=[benchmarks_root]))
+def test_list_all(resources_root):
+ qpi_spec_list = list(QPISpec.list_all(paths=[resources_root]))
assert len(qpi_spec_list) is 2
for item in qpi_spec_list:
assert SpecProp.NAME in item
diff --git a/tests/unit/score_test.py b/tests/unit/score_test.py
new file mode 100644
index 00000000..742be70b
--- /dev/null
+++ b/tests/unit/score_test.py
@@ -0,0 +1,21 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corporation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+from os import path
+import pytest
+from qtip import score
+
+
+def test_storperf(data_root):
+ report_file = path.join(data_root, 'external', 'storperf', 'report.json')
+ qpi_report = score.storperf(report_file)
+ assert qpi_report['sections'][0]['score'] == pytest.approx(1.869, 0.1) # IOPS
+ assert qpi_report['sections'][1]['score'] == pytest.approx(0.722, 0.1) # Throughput
+ assert qpi_report['sections'][2]['score'] == pytest.approx(1.896, 0.1) # Latency
+ assert(qpi_report['score'] == 3064) # 3064 is calculated manually