"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ironic/tests/unit/drivers/modules/test_inspector.py" between
ironic-17.0.2.tar.gz and ironic-17.0.3.tar.gz

About: OpenStack Ironic (Optional Service: Bare-Metal Provisioning) aims to provision bare metal machines instead of virtual machines, forked from the Nova baremetal driver.
The "Wallaby" series (latest release).

test_inspector.py  (ironic-17.0.2):test_inspector.py  (ironic-17.0.3)
skipping to change at line 121 skipping to change at line 121
client.get_endpoint.return_value = 'http://127.0.0.1:5050' client.get_endpoint.return_value = 'http://127.0.0.1:5050'
self.assertRaisesRegex(exception.InvalidParameterValue, 'Loopback', self.assertRaisesRegex(exception.InvalidParameterValue, 'Loopback',
inspector._get_callback_endpoint, client) inspector._get_callback_endpoint, client)
@mock.patch.object(eventlet, 'spawn_n', lambda f, *a, **kw: f(*a, **kw)) @mock.patch.object(eventlet, 'spawn_n', lambda f, *a, **kw: f(*a, **kw))
@mock.patch('ironic.drivers.modules.inspector._get_client', autospec=True) @mock.patch('ironic.drivers.modules.inspector._get_client', autospec=True)
class InspectHardwareTestCase(BaseTestCase): class InspectHardwareTestCase(BaseTestCase):
def test_validate_ok(self, mock_client): def test_validate_ok(self, mock_client):
self.iface.validate(self.task) self.iface.validate(self.task)
def test_validate_invalid_kernel_params(self, mock_client):
CONF.set_override('extra_kernel_params', 'abcdef', group='inspector')
self.assertRaises(exception.InvalidParameterValue,
self.iface.validate, self.task)
@mock.patch.object(redfish_utils, 'get_system', autospec=True) @mock.patch.object(redfish_utils, 'get_system', autospec=True)
@mock.patch.object(inspect_utils, 'create_ports_if_not_exist', @mock.patch.object(inspect_utils, 'create_ports_if_not_exist',
autospec=True) autospec=True)
def test_validate_require_managed_boot(self, mock_get_system, def test_validate_require_managed_boot(self, mock_get_system,
mock_create_ports_if_not_exist, mock_create_ports_if_not_exist,
mock_client): mock_client):
CONF.set_override('require_managed_boot', True, group='inspector') CONF.set_override('require_managed_boot', True, group='inspector')
self.driver.boot.validate_inspection.side_effect = ( self.driver.boot.validate_inspection.side_effect = (
exception.UnsupportedDriverExtension('')) exception.UnsupportedDriverExtension(''))
self.assertRaises(exception.UnsupportedDriverExtension, self.assertRaises(exception.UnsupportedDriverExtension,
skipping to change at line 229 skipping to change at line 224
self.assertFalse(self.driver.boot.clean_up_ramdisk.called) self.assertFalse(self.driver.boot.clean_up_ramdisk.called)
@mock.patch.object(redfish_utils, 'get_system', autospec=True) @mock.patch.object(redfish_utils, 'get_system', autospec=True)
@mock.patch.object(inspect_utils, 'create_ports_if_not_exist', @mock.patch.object(inspect_utils, 'create_ports_if_not_exist',
autospec=True) autospec=True)
def test_managed_custom_params(self, mock_get_system, def test_managed_custom_params(self, mock_get_system,
mock_create_ports_if_not_exist, mock_create_ports_if_not_exist,
mock_client): mock_client):
CONF.set_override('extra_kernel_params', CONF.set_override('extra_kernel_params',
'ipa-inspection-collectors=default,logs ' 'ipa-inspection-collectors=default,logs '
'ipa-collect-dhcp=1', 'ipa-collect-dhcp=1 something',
group='inspector') group='inspector')
endpoint = 'http://192.169.0.42:5050/v1' endpoint = 'http://192.169.0.42:5050/v1'
mock_client.return_value.get_endpoint.return_value = endpoint mock_client.return_value.get_endpoint.return_value = endpoint
mock_introspect = mock_client.return_value.start_introspection mock_introspect = mock_client.return_value.start_introspection
self.iface.validate(self.task) self.iface.validate(self.task)
self.assertEqual(states.INSPECTWAIT, self.assertEqual(states.INSPECTWAIT,
self.iface.inspect_hardware(self.task)) self.iface.inspect_hardware(self.task))
mock_introspect.assert_called_once_with(self.node.uuid, mock_introspect.assert_called_once_with(self.node.uuid,
manage_boot=False) manage_boot=False)
self.driver.boot.prepare_ramdisk.assert_called_once_with( self.driver.boot.prepare_ramdisk.assert_called_once_with(
self.task, ramdisk_params={ self.task, ramdisk_params={
'ipa-inspection-callback-url': endpoint + '/continue', 'ipa-inspection-callback-url': endpoint + '/continue',
'ipa-inspection-collectors': 'default,logs', 'ipa-inspection-collectors': 'default,logs',
'ipa-collect-dhcp': '1', 'ipa-collect-dhcp': '1',
'something': None,
}) })
self.driver.network.add_inspection_network.assert_called_once_with( self.driver.network.add_inspection_network.assert_called_once_with(
self.task) self.task)
self.driver.power.set_power_state.assert_has_calls([ self.driver.power.set_power_state.assert_has_calls([
mock.call(self.task, states.POWER_OFF, timeout=None), mock.call(self.task, states.POWER_OFF, timeout=None),
mock.call(self.task, states.POWER_ON, timeout=None), mock.call(self.task, states.POWER_ON, timeout=None),
]) ])
self.assertFalse(self.driver.network.remove_inspection_network.called) self.assertFalse(self.driver.network.remove_inspection_network.called)
self.assertFalse(self.driver.boot.clean_up_ramdisk.called) self.assertFalse(self.driver.boot.clean_up_ramdisk.called)
 End of changes. 3 change blocks. 
6 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)