From 59cc506c563a12e0a11b12e7b3742fec25e1e0f3 Mon Sep 17 00:00:00 2001 From: Yujun Zhang Date: Wed, 30 Aug 2017 14:43:41 +0800 Subject: Add score calculation module for storperf Change-Id: I469ee4d768e16a27c3bde660bc1029d5a3507b72 Signed-off-by: Yujun Zhang --- tests/unit/score_test.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/unit/score_test.py (limited to 'tests/unit/score_test.py') 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 -- cgit 1.2.3-korg