summaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/scenarios/storage/test_fio.py
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/benchmark/scenarios/storage/test_fio.py
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/benchmark/scenarios/storage/test_fio.py')
-rw-r--r--tests/unit/benchmark/scenarios/storage/test_fio.py23
1 files changed, 16 insertions, 7 deletions
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()