aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/scenarios/storage
diff options
context:
space:
mode:
authorQiLiang <liangqi1@huawei.com>2015-10-21 12:29:53 +0000
committerQiLiang <liangqi1@huawei.com>2015-10-27 03:34:28 +0000
commit2e1094d4aee93180126d3ce86db3cc7df2e87bc5 (patch)
tree221e98fd325ff6fcb4fbbb3e656a3789f3a77342 /tests/unit/benchmark/scenarios/storage
parent884926d05f435217c7dac038b3bfbd7e9d05826b (diff)
Heat context code refactor part 2
Heat context code refactor to cater for the evolution of the Yardstick framework. Refactor runner_cfg host/target info handle, as specified at https://etherpad.opnfv.org/p/yardstick_framework step 4. Get general Context info (use Context.get). Before this refactor host and target vm must have the same user name and ssh key, that is not general enough for later extension. test_case.yaml do NOT need to change. JIRA: YARDSTICK-168 Change-Id: I5cfe868f3c6f633214ef550bc9676fe1de0709db Signed-off-by: QiLiang <liangqi1@huawei.com>
Diffstat (limited to 'tests/unit/benchmark/scenarios/storage')
-rw-r--r--tests/unit/benchmark/scenarios/storage/test_fio.py42
1 files changed, 22 insertions, 20 deletions
diff --git a/tests/unit/benchmark/scenarios/storage/test_fio.py b/tests/unit/benchmark/scenarios/storage/test_fio.py
index b47aed968..ac8aa0684 100644
--- a/tests/unit/benchmark/scenarios/storage/test_fio.py
+++ b/tests/unit/benchmark/scenarios/storage/test_fio.py
@@ -24,9 +24,11 @@ class FioTestCase(unittest.TestCase):
def setUp(self):
self.ctx = {
- 'host': '172.16.0.137',
- 'user': 'cirros',
- 'key_filename': 'mykey.key'
+ 'host': {
+ 'ip': '172.16.0.137',
+ 'user': 'cirros',
+ 'key_filename': 'mykey.key'
+ }
}
self.sample_output = {
'read': 'fio_read_sample_output.json',
@@ -36,7 +38,6 @@ class FioTestCase(unittest.TestCase):
def test_fio_successful_setup(self, mock_ssh):
- p = fio.Fio(self.ctx)
options = {
'filename': '/home/ec2-user/data.raw',
'bs': '4k',
@@ -44,6 +45,7 @@ class FioTestCase(unittest.TestCase):
'ramp_time': 10
}
args = {'options': options}
+ p = fio.Fio(args, self.ctx)
p.setup()
mock_ssh.SSH().execute.return_value = (0, '', '')
@@ -52,7 +54,6 @@ class FioTestCase(unittest.TestCase):
def test_fio_successful_no_sla(self, mock_ssh):
- p = fio.Fio(self.ctx)
options = {
'filename': '/home/ec2-user/data.raw',
'bs': '4k',
@@ -60,6 +61,7 @@ class FioTestCase(unittest.TestCase):
'ramp_time': 10
}
args = {'options': options}
+ p = fio.Fio(args, self.ctx)
result = {}
p.client = mock_ssh.SSH()
@@ -67,7 +69,7 @@ class FioTestCase(unittest.TestCase):
sample_output = self._read_sample_output(self.sample_output['rw'])
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- p.run(args, result)
+ p.run(result)
expected_result = '{"read_bw": 83888, "read_iops": 20972,' \
'"read_lat": 236.8, "write_bw": 84182, "write_iops": 21045,'\
@@ -77,7 +79,6 @@ class FioTestCase(unittest.TestCase):
def test_fio_successful_read_no_sla(self, mock_ssh):
- p = fio.Fio(self.ctx)
options = {
'filename': '/home/ec2-user/data.raw',
'bs': '4k',
@@ -85,6 +86,7 @@ class FioTestCase(unittest.TestCase):
'ramp_time': 10
}
args = {'options': options}
+ p = fio.Fio(args, self.ctx)
result = {}
p.client = mock_ssh.SSH()
@@ -92,7 +94,7 @@ class FioTestCase(unittest.TestCase):
sample_output = self._read_sample_output(self.sample_output['read'])
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- p.run(args, result)
+ p.run(result)
expected_result = '{"read_bw": 36113, "read_iops": 9028,' \
'"read_lat": 108.7}'
@@ -101,7 +103,6 @@ class FioTestCase(unittest.TestCase):
def test_fio_successful_write_no_sla(self, mock_ssh):
- p = fio.Fio(self.ctx)
options = {
'filename': '/home/ec2-user/data.raw',
'bs': '4k',
@@ -109,6 +110,7 @@ class FioTestCase(unittest.TestCase):
'ramp_time': 10
}
args = {'options': options}
+ p = fio.Fio(args, self.ctx)
result = {}
p.client = mock_ssh.SSH()
@@ -116,7 +118,7 @@ class FioTestCase(unittest.TestCase):
sample_output = self._read_sample_output(self.sample_output['write'])
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- p.run(args, result)
+ p.run(result)
expected_result = '{"write_bw": 35107, "write_iops": 8776,'\
'"write_lat": 111.74}'
@@ -125,7 +127,6 @@ class FioTestCase(unittest.TestCase):
def test_fio_successful_lat_sla(self, mock_ssh):
- p = fio.Fio(self.ctx)
options = {
'filename': '/home/ec2-user/data.raw',
'bs': '4k',
@@ -136,6 +137,7 @@ class FioTestCase(unittest.TestCase):
'options': options,
'sla': {'write_lat': 300.1}
}
+ p = fio.Fio(args, self.ctx)
result = {}
p.client = mock_ssh.SSH()
@@ -143,7 +145,7 @@ class FioTestCase(unittest.TestCase):
sample_output = self._read_sample_output(self.sample_output['rw'])
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- p.run(args, result)
+ p.run(result)
expected_result = '{"read_bw": 83888, "read_iops": 20972,' \
'"read_lat": 236.8, "write_bw": 84182, "write_iops": 21045,'\
@@ -154,7 +156,6 @@ class FioTestCase(unittest.TestCase):
def test_fio_unsuccessful_lat_sla(self, mock_ssh):
- p = fio.Fio(self.ctx)
options = {
'filename': '/home/ec2-user/data.raw',
'bs': '4k',
@@ -165,17 +166,17 @@ class FioTestCase(unittest.TestCase):
'options': options,
'sla': {'write_lat': 200.1}
}
+ p = fio.Fio(args, self.ctx)
result = {}
p.client = mock_ssh.SSH()
sample_output = self._read_sample_output(self.sample_output['rw'])
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- self.assertRaises(AssertionError, p.run, args, result)
+ self.assertRaises(AssertionError, p.run, result)
def test_fio_successful_bw_iops_sla(self, mock_ssh):
- p = fio.Fio(self.ctx)
options = {
'filename': '/home/ec2-user/data.raw',
'bs': '4k',
@@ -186,6 +187,7 @@ class FioTestCase(unittest.TestCase):
'options': options,
'sla': {'read_iops': 20000}
}
+ p = fio.Fio(args, self.ctx)
result = {}
p.client = mock_ssh.SSH()
@@ -193,7 +195,7 @@ class FioTestCase(unittest.TestCase):
sample_output = self._read_sample_output(self.sample_output['rw'])
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- p.run(args, result)
+ p.run(result)
expected_result = '{"read_bw": 83888, "read_iops": 20972,' \
'"read_lat": 236.8, "write_bw": 84182, "write_iops": 21045,'\
@@ -203,7 +205,6 @@ class FioTestCase(unittest.TestCase):
def test_fio_unsuccessful_bw_iops_sla(self, mock_ssh):
- p = fio.Fio(self.ctx)
options = {
'filename': '/home/ec2-user/data.raw',
'bs': '4k',
@@ -214,17 +215,17 @@ class FioTestCase(unittest.TestCase):
'options': options,
'sla': {'read_iops': 30000}
}
+ p = fio.Fio(args, self.ctx)
result = {}
p.client = mock_ssh.SSH()
sample_output = self._read_sample_output(self.sample_output['rw'])
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- self.assertRaises(AssertionError, p.run, args, result)
+ self.assertRaises(AssertionError, p.run, result)
def test_fio_unsuccessful_script_error(self, mock_ssh):
- p = fio.Fio(self.ctx)
options = {
'filename': '/home/ec2-user/data.raw',
'bs': '4k',
@@ -232,12 +233,13 @@ class FioTestCase(unittest.TestCase):
'ramp_time': 10
}
args = {'options': options}
+ p = fio.Fio(args, self.ctx)
result = {}
p.client = mock_ssh.SSH()
mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR')
- self.assertRaises(RuntimeError, p.run, args, result)
+ self.assertRaises(RuntimeError, p.run, result)
def _read_sample_output(self, file_name):
curr_path = os.path.dirname(os.path.abspath(__file__))