diff options
Diffstat (limited to 'tests/unit/benchmark/scenarios/storage')
-rw-r--r-- | tests/unit/benchmark/scenarios/storage/test_fio.py | 42 |
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__)) |