summaryrefslogtreecommitdiff
path: root/ironic_python_agent/tests/unit
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-03-03 07:14:44 +0000
committerGerrit Code Review <review@openstack.org>2021-03-03 07:14:44 +0000
commit7931ccedfb8c3f204896a26152e259a67196e79e (patch)
tree2c1b2ae99ad454bc02843a938ea1a68ce21309c1 /ironic_python_agent/tests/unit
parent77bc398833707445bc79290387e79b67a4e05222 (diff)
parentbff252c7263c70edb52644f7ac64d39b9f6b0bd0 (diff)
downloadironic-python-agent-7931ccedfb8c3f204896a26152e259a67196e79e.tar.gz
Merge "Remove default parameter from execute"
Diffstat (limited to 'ironic_python_agent/tests/unit')
-rw-r--r--ironic_python_agent/tests/unit/extensions/test_standby.py22
-rw-r--r--ironic_python_agent/tests/unit/test_hardware.py18
2 files changed, 14 insertions, 26 deletions
diff --git a/ironic_python_agent/tests/unit/extensions/test_standby.py b/ironic_python_agent/tests/unit/extensions/test_standby.py
index 57a99a84..a25d38ac 100644
--- a/ironic_python_agent/tests/unit/extensions/test_standby.py
+++ b/ironic_python_agent/tests/unit/extensions/test_standby.py
@@ -178,7 +178,7 @@ class TestStandbyExtension(base.IronicAgentTest):
execute_mock.return_value = ('', '')
standby._write_image(image_info, device)
- execute_mock.assert_called_once_with(*command, check_exit_code=[0])
+ execute_mock.assert_called_once_with(*command)
fix_gpt_mock.assert_called_once_with(device, node_uuid=None)
fix_gpt_mock.side_effect = exception.InstanceDeployFailure
@@ -193,7 +193,7 @@ class TestStandbyExtension(base.IronicAgentTest):
image_info,
device)
- execute_mock.assert_called_once_with(*command, check_exit_code=[0])
+ execute_mock.assert_called_once_with(*command)
@mock.patch.object(utils, 'get_node_boot_mode', lambda self: 'bios')
@mock.patch.object(hardware, 'dispatch_to_managers', autospec=True)
@@ -1044,8 +1044,7 @@ class TestStandbyExtension(base.IronicAgentTest):
self.agent_extension._run_shutdown_command('poweroff')
calls = [mock.call('sync'),
- mock.call('poweroff', use_standard_locale=True,
- check_exit_code=[0])]
+ mock.call('poweroff', use_standard_locale=True)]
execute_mock.assert_has_calls(calls)
@mock.patch('ironic_python_agent.utils.execute', autospec=True)
@@ -1057,8 +1056,7 @@ class TestStandbyExtension(base.IronicAgentTest):
self.agent_extension._run_shutdown_command('poweroff')
calls = [mock.call('hwclock', '-v', '--systohc'),
mock.call('sync'),
- mock.call('poweroff', use_standard_locale=True,
- check_exit_code=[0]),
+ mock.call('poweroff', use_standard_locale=True),
mock.call("echo o > /proc/sysrq-trigger", shell=True)]
execute_mock.assert_has_calls(calls)
@@ -1070,8 +1068,7 @@ class TestStandbyExtension(base.IronicAgentTest):
self.agent_extension._run_shutdown_command('reboot')
calls = [mock.call('sync'),
- mock.call('reboot', use_standard_locale=True,
- check_exit_code=[0]),
+ mock.call('reboot', use_standard_locale=True),
mock.call("echo b > /proc/sysrq-trigger", shell=True)]
execute_mock.assert_has_calls(calls)
@@ -1082,8 +1079,7 @@ class TestStandbyExtension(base.IronicAgentTest):
success_result = self.agent_extension.run_image()
success_result.join()
calls = [mock.call('sync'),
- mock.call('reboot', use_standard_locale=True,
- check_exit_code=[0])]
+ mock.call('reboot', use_standard_locale=True)]
execute_mock.assert_has_calls(calls)
self.assertEqual('SUCCEEDED', success_result.command_status)
@@ -1105,8 +1101,7 @@ class TestStandbyExtension(base.IronicAgentTest):
success_result.join()
calls = [mock.call('sync'),
- mock.call('poweroff', use_standard_locale=True,
- check_exit_code=[0])]
+ mock.call('poweroff', use_standard_locale=True)]
execute_mock.assert_has_calls(calls)
self.assertEqual('SUCCEEDED', success_result.command_status)
@@ -1135,8 +1130,7 @@ class TestStandbyExtension(base.IronicAgentTest):
calls = [mock.call('ntpdate', '192.168.1.1'),
mock.call('hwclock', '-v', '--systohc'),
mock.call('sync'),
- mock.call('poweroff', use_standard_locale=True,
- check_exit_code=[0])]
+ mock.call('poweroff', use_standard_locale=True)]
execute_mock.assert_has_calls(calls)
self.assertEqual('SUCCEEDED', success_result.command_status)
diff --git a/ironic_python_agent/tests/unit/test_hardware.py b/ironic_python_agent/tests/unit/test_hardware.py
index 22f8a188..646cf01b 100644
--- a/ironic_python_agent/tests/unit/test_hardware.py
+++ b/ironic_python_agent/tests/unit/test_hardware.py
@@ -725,8 +725,7 @@ class TestGenericHardwareManager(base.IronicAgentTest):
mocked_execute.return_value = (hws.BLK_DEVICE_TEMPLATE, '')
self.assertEqual('/dev/sdb', self.hardware.get_os_install_device())
mocked_execute.assert_called_once_with(
- 'lsblk', '-Pbia', '-oKNAME,MODEL,SIZE,ROTA,TYPE,UUID,PARTUUID',
- check_exit_code=[0])
+ 'lsblk', '-Pbia', '-oKNAME,MODEL,SIZE,ROTA,TYPE,UUID,PARTUUID')
mock_cached_node.assert_called_once_with()
@mock.patch.object(os, 'readlink', autospec=True)
@@ -747,8 +746,7 @@ class TestGenericHardwareManager(base.IronicAgentTest):
# should always be smaller
self.assertEqual('/dev/md0', self.hardware.get_os_install_device())
mocked_execute.assert_called_once_with(
- 'lsblk', '-Pbia', '-oKNAME,MODEL,SIZE,ROTA,TYPE,UUID,PARTUUID',
- check_exit_code=[0])
+ 'lsblk', '-Pbia', '-oKNAME,MODEL,SIZE,ROTA,TYPE,UUID,PARTUUID')
mock_cached_node.assert_called_once_with()
@mock.patch.object(os, 'readlink', autospec=True)
@@ -766,8 +764,7 @@ class TestGenericHardwareManager(base.IronicAgentTest):
ex = self.assertRaises(errors.DeviceNotFound,
self.hardware.get_os_install_device)
mocked_execute.assert_called_once_with(
- 'lsblk', '-Pbia', '-oKNAME,MODEL,SIZE,ROTA,TYPE,UUID,PARTUUID',
- check_exit_code=[0])
+ 'lsblk', '-Pbia', '-oKNAME,MODEL,SIZE,ROTA,TYPE,UUID,PARTUUID')
self.assertIn(str(4 * units.Gi), ex.details)
mock_cached_node.assert_called_once_with()
@@ -4091,8 +4088,7 @@ class TestModuleFunctions(base.IronicAgentTest):
mocked_execute.return_value = (hws.BLK_DEVICE_TEMPLATE_SMALL, '')
result = hardware.list_all_block_devices()
mocked_execute.assert_called_once_with(
- 'lsblk', '-Pbia', '-oKNAME,MODEL,SIZE,ROTA,TYPE,UUID,PARTUUID',
- check_exit_code=[0])
+ 'lsblk', '-Pbia', '-oKNAME,MODEL,SIZE,ROTA,TYPE,UUID,PARTUUID')
self.assertEqual(BLK_DEVICE_TEMPLATE_SMALL_DEVICES, result)
mocked_udev.assert_called_once_with()
@@ -4110,8 +4106,7 @@ class TestModuleFunctions(base.IronicAgentTest):
mocked_execute.return_value = (hws.RAID_BLK_DEVICE_TEMPLATE, '')
result = hardware.list_all_block_devices(ignore_empty=False)
mocked_execute.assert_called_once_with(
- 'lsblk', '-Pbia', '-oKNAME,MODEL,SIZE,ROTA,TYPE,UUID,PARTUUID',
- check_exit_code=[0])
+ 'lsblk', '-Pbia', '-oKNAME,MODEL,SIZE,ROTA,TYPE,UUID,PARTUUID')
self.assertEqual(RAID_BLK_DEVICE_TEMPLATE_DEVICES, result)
mocked_udev.assert_called_once_with()
@@ -4123,8 +4118,7 @@ class TestModuleFunctions(base.IronicAgentTest):
mocked_execute.return_value = ('TYPE="foo" MODEL="model"', '')
result = hardware.list_all_block_devices()
mocked_execute.assert_called_once_with(
- 'lsblk', '-Pbia', '-oKNAME,MODEL,SIZE,ROTA,TYPE,UUID,PARTUUID',
- check_exit_code=[0])
+ 'lsblk', '-Pbia', '-oKNAME,MODEL,SIZE,ROTA,TYPE,UUID,PARTUUID')
self.assertEqual([], result)
mocked_udev.assert_called_once_with()