diff options
| author | Arne Wiebalck <Arne.Wiebalck@cern.ch> | 2021-05-19 18:37:45 +0200 |
|---|---|---|
| committer | Arne Wiebalck <Arne.Wiebalck@cern.ch> | 2021-05-21 16:33:11 +0200 |
| commit | 20c5894bc25389b7ea39a02e3e3853bc4cc41da7 (patch) | |
| tree | 6fc4b9cc38cf73b4c6eabd52351046a7a5305e52 /ironic_python_agent/tests/unit | |
| parent | 6fc5a14760a298827e4f3c2229bd738dcfdd9e18 (diff) | |
| download | ironic-python-agent-20c5894bc25389b7ea39a02e3e3853bc4cc41da7.tar.gz | |
Burn-in: Add disk step
Add a clean step for disk burn-in via fio. Get basic
run parameters from the node's driver_info.
Story: #2007523
Task: #42384
Change-Id: I5f5e336bd629846b3d779fd0fc7a2060b385b035
Diffstat (limited to 'ironic_python_agent/tests/unit')
| -rw-r--r-- | ironic_python_agent/tests/unit/test_burnin.py | 55 | ||||
| -rw-r--r-- | ironic_python_agent/tests/unit/test_hardware.py | 7 |
2 files changed, 62 insertions, 0 deletions
diff --git a/ironic_python_agent/tests/unit/test_burnin.py b/ironic_python_agent/tests/unit/test_burnin.py index 7f411b9f..316aaebd 100644 --- a/ironic_python_agent/tests/unit/test_burnin.py +++ b/ironic_python_agent/tests/unit/test_burnin.py @@ -17,6 +17,7 @@ from oslo_concurrency import processutils from ironic_python_agent import burnin from ironic_python_agent import errors +from ironic_python_agent import hardware from ironic_python_agent.tests.unit import base @@ -63,6 +64,7 @@ class TestBurnin(base.IronicAgentTest): burnin.stress_ng_vm(node) mock_execute.assert_called_once_with( + 'stress-ng', '--vm', 0, '--vm-bytes', '98%', '--timeout', 86400, '--metrics-brief') @@ -89,3 +91,56 @@ class TestBurnin(base.IronicAgentTest): self.assertRaises(errors.CommandExecutionError, burnin.stress_ng_vm, node) + + @mock.patch.object(hardware, 'list_all_block_devices', autospec=True) + def test_fio_disk_default(self, mock_list, mock_execute): + + node = {'driver_info': {}} + + mock_list.return_value = [ + hardware.BlockDevice('/dev/sdj', 'big', 1073741824, True), + hardware.BlockDevice('/dev/hdaa', 'small', 65535, False), + ] + mock_execute.return_value = (['out', 'err']) + + burnin.fio_disk(node) + + mock_execute.assert_called_once_with( + 'fio', '--rw', 'readwrite', '--bs', '4k', '--direct', 1, + '--ioengine', 'libaio', '--iodepth', '32', '--verify', + 'crc32c', '--verify_dump', 1, '--continue_on_error', 'verify', + '--loops', 4, '--runtime', 0, '--time_based', '--name', + '/dev/sdj', '--name', '/dev/hdaa') + + @mock.patch.object(hardware, 'list_all_block_devices', autospec=True) + def test_fio_disk_no_default(self, mock_list, mock_execute): + + node = {'driver_info': {'agent_burnin_fio_disk_runtime': 600, + 'agent_burnin_fio_disk_loops': 5}} + + mock_list.return_value = [ + hardware.BlockDevice('/dev/sdj', 'big', 1073741824, True), + hardware.BlockDevice('/dev/hdaa', 'small', 65535, False), + ] + mock_execute.return_value = (['out', 'err']) + + burnin.fio_disk(node) + + mock_execute.assert_called_once_with( + 'fio', '--rw', 'readwrite', '--bs', '4k', '--direct', 1, + '--ioengine', 'libaio', '--iodepth', '32', '--verify', + 'crc32c', '--verify_dump', 1, '--continue_on_error', 'verify', + '--loops', 5, '--runtime', 600, '--time_based', '--name', + '/dev/sdj', '--name', '/dev/hdaa') + + @mock.patch.object(hardware, 'list_all_block_devices', autospec=True) + def test_fio_disk_no_fio(self, mock_list, mock_execute): + + node = {'driver_info': {}} + mock_execute.side_effect = (['out', 'err'], + processutils.ProcessExecutionError()) + + burnin.fio_disk(node) + + self.assertRaises(errors.CommandExecutionError, + burnin.fio_disk, node) diff --git a/ironic_python_agent/tests/unit/test_hardware.py b/ironic_python_agent/tests/unit/test_hardware.py index a4739b65..fbb8e650 100644 --- a/ironic_python_agent/tests/unit/test_hardware.py +++ b/ironic_python_agent/tests/unit/test_hardware.py @@ -158,6 +158,13 @@ class TestGenericHardwareManager(base.IronicAgentTest): 'abortable': True }, { + 'step': 'burnin_disk', + 'priority': 0, + 'interface': 'deploy', + 'reboot_requested': False, + 'abortable': True + }, + { 'step': 'burnin_memory', 'priority': 0, 'interface': 'deploy', |
