aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorhoujingwen <houjingwen@huawei.com>2015-09-16 11:19:15 +0000
committerhoujingwen <houjingwen@huawei.com>2015-09-24 11:24:44 +0800
commit735af0fc05d73cbc7bd97b52a230d966cbfec6c3 (patch)
tree0bd872895a6ee0fa9088dd5c4512536f2edd85b5 /tests/unit
parent8650a0a22182987e70f34653d8521ea2072ee5c8 (diff)
Fix bug in fio scenario
1) when duration>3600s in fio.yaml, ssh time out 2) sometimes the latency value in test result is null 3) update plot.py, fit for code update in fio.py 4) small bug in file.py (result output dump) Add --output-format=json in default args, so fio command can return json format data. JIRA: YARDSTICK-143 Change-Id: Ie02977b8c9f11986a1eed66896b84d18db3d2211 Signed-off-by: houjingwen <houjingwen@huawei.com>
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/benchmark/scenarios/storage/fio_sample_output.json1
-rw-r--r--tests/unit/benchmark/scenarios/storage/test_fio.py23
2 files changed, 17 insertions, 7 deletions
diff --git a/tests/unit/benchmark/scenarios/storage/fio_sample_output.json b/tests/unit/benchmark/scenarios/storage/fio_sample_output.json
new file mode 100644
index 000000000..4c7501818
--- /dev/null
+++ b/tests/unit/benchmark/scenarios/storage/fio_sample_output.json
@@ -0,0 +1 @@
+{"jobs": [{"trim": {"io_bytes": 0, "slat": {"max": 0, "mean": 0.0, "stddev": 0.0, "min": 0}, "bw_max": 0, "bw_mean": 0.0, "iops": 0, "bw": 0, "lat": {"max": 0, "mean": 0.0, "stddev": 0.0, "min": 0}, "bw_agg": 0.0, "clat": {"max": 0, "mean": 0.0, "percentile": {"70.000000": 0, "5.000000": 0, "50.000000": 0, "99.990000": 0, "30.000000": 0, "10.000000": 0, "99.000000": 0, "0.00": 0, "90.000000": 0, "95.000000": 0, "60.000000": 0, "40.000000": 0, "20.000000": 0, "99.900000": 0, "99.950000": 0, "1.000000": 0, "99.500000": 0, "80.000000": 0}, "stddev": 0.0, "min": 0}, "runtime": 0, "bw_min": 0, "bw_dev": 0.0}, "latency_us": {"10": 0.01, "750": 0.03, "20": 0.0, "50": 0.02, "2": 0.01, "4": 0.01, "100": 0.75, "250": 88.37, "500": 10.72, "1000": 0.01}, "latency_ms": {"10": 0.01, "750": 0.0, "20": 0.01, ">=2000": 0.0, "50": 0.01, "2000": 0.0, "2": 0.07, "4": 0.01, "100": 0.0, "250": 0.01, "500": 0.0, "1000": 0.01}, "read": {"io_bytes": 839056, "slat": {"max": 1990, "mean": 18.14, "stddev": 15.4, "min": 0}, "bw_max": 10328, "bw_mean": 8721.27, "iops": 20972, "bw": 83888, "lat": {"max": 776676, "mean": 236.8, "stddev": 4668.12, "min": 45}, "bw_agg": 8721.27, "clat": {"max": 776663, "mean": 217.79, "percentile": {"70.000000": 199, "5.000000": 119, "50.000000": 175, "99.990000": 15168, "30.000000": 155, "10.000000": 131, "99.000000": 342, "0.00": 0, "90.000000": 247, "95.000000": 278, "60.000000": 185, "40.000000": 165, "20.000000": 145, "99.900000": 820, "99.950000": 1272, "1.000000": 96, "99.500000": 370, "80.000000": 217}, "stddev": 4667.79, "min": 0}, "runtime": 10002, "bw_min": 4, "bw_dev": 2178.08}, "majf": 0, "ctx": 490590, "minf": 87, "jobname": "yardstick-fio", "write": {"io_bytes": 841992, "slat": {"max": 2594, "mean": 19.78, "stddev": 16.25, "min": 0}, "bw_max": 10472, "bw_mean": 8464.0, "iops": 21045, "bw": 84182, "lat": {"max": 776709, "mean": 233.55, "stddev": 3115.46, "min": 64}, "bw_agg": 8464.0, "clat": {"max": 776685, "mean": 212.87, "percentile": {"70.000000": 211, "5.000000": 135, "50.000000": 187, "99.990000": 3536, "30.000000": 169, "10.000000": 145, "99.000000": 358, "0.00": 0, "90.000000": 258, "95.000000": 290, "60.000000": 197, "40.000000": 177, "20.000000": 159, "99.900000": 756, "99.950000": 1288, "1.000000": 114, "99.500000": 382, "80.000000": 229}, "stddev": 3115.23, "min": 0}, "runtime": 10002, "bw_min": 4, "bw_dev": 2584.23}, "iodepth_level": {"16": 0.0, "32": 0.0, "1": 111.92, "2": 0.0, "4": 0.0, ">=64": 0.0, "8": 0.0}, "usr_cp": 2.87, "error": 0, "sys_cp": 12.37, "groupid": 0}], "fio version": "fio-2.1.3", "disk_util": [{"aggr_write_ticks": 42020, "read_merges": 0, "name": "dm-0", "write_ios": 233547, "aggr_write_ios": 235129, "aggr_read_ticks": 42576, "read_ios": 233492, "util": 97.22, "read_ticks": 42096, "aggr_write_merge": 0, "write_merges": 0, "aggr_in_queue": 84524, "aggr_read_ios": 235224, "aggr_util": 96.96, "aggr_read_merges": 0, "in_queue": 83732, "write_ticks": 41468}, {"read_merges": 0, "name": "vda", "write_ios": 235129, "read_ios": 235224, "util": 96.96, "read_ticks": 42576, "write_merges": 0, "in_queue": 84524, "write_ticks": 42020}]}
diff --git a/tests/unit/benchmark/scenarios/storage/test_fio.py b/tests/unit/benchmark/scenarios/storage/test_fio.py
index 54f493ee6..45e8a9429 100644
--- a/tests/unit/benchmark/scenarios/storage/test_fio.py
+++ b/tests/unit/benchmark/scenarios/storage/test_fio.py
@@ -14,6 +14,7 @@
import mock
import unittest
import json
+import os
from yardstick.benchmark.scenarios.storage import fio
@@ -34,7 +35,7 @@ class FioTestCase(unittest.TestCase):
options = {
'filename': "/home/ec2-user/data.raw",
'bs': "4k",
- 'rw': "write",
+ 'rw': "rw",
'ramp_time': 10
}
args = {'options': options}
@@ -50,19 +51,21 @@ class FioTestCase(unittest.TestCase):
options = {
'filename': "/home/ec2-user/data.raw",
'bs': "4k",
- 'rw': "write",
+ 'rw': "rw",
'ramp_time': 10
}
args = {'options': options}
p.client = mock_ssh.SSH()
- sample_output = '{"read_bw": "N/A", "write_lat": "407.08usec", \
- "read_iops": "N/A", "write_bw": "9507KB/s", \
- "write_iops": "2376", "read_lat": "N/A"}'
+ sample_output = self._read_sample_output()
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
result = p.run(args)
- expected_result = json.loads(sample_output)
+
+ expected_result = '{"read_bw": 83888, "read_iops": 20972,' \
+ '"read_lat": 236.8, "write_bw": 84182, "write_iops": 21045,'\
+ '"write_lat": 233.55}'
+ expected_result = json.loads(expected_result)
self.assertEqual(result, expected_result)
def test_fio_unsuccessful_script_error(self, mock_ssh):
@@ -71,7 +74,7 @@ class FioTestCase(unittest.TestCase):
options = {
'filename': "/home/ec2-user/data.raw",
'bs': "4k",
- 'rw': "write",
+ 'rw': "rw",
'ramp_time': 10
}
args = {'options': options}
@@ -80,6 +83,12 @@ class FioTestCase(unittest.TestCase):
mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR')
self.assertRaises(RuntimeError, p.run, args)
+ def _read_sample_output(self):
+ curr_path = os.path.dirname(os.path.abspath(__file__))
+ output = os.path.join(curr_path, 'fio_sample_output.json')
+ with open(output) as f:
+ sample_output = f.read()
+ return sample_output
def main():
unittest.main()