CI: Fix PXE Ananconda cleanup test
The PXE Annaconda dhcp cleanup test triggers the dhcp_factory clean up code by default. Which is good! Problem is, if you don't have dnsmasq installed, things blow up. Specifically becuase it was called in such a way where it was trying to clean up dhcp records for nodes. Example: ironic.common.exception.InstanceDeployFailure: An error occurred after deployment, while preparing to reboot the node 1be26c0b-03f2-4d2e-ae87-c02d7f33c123: [Errno 2] No such file or directory: '/etc/dnsmasq.d/hostsdir.d/ironic-52:54:00:cf:2d:31.conf' Instead of executing that far, we just now check that we did, indeed call for dhcp cleanup. This was discovered while trying to fix unit test race conditions and random failures in CI. Change-Id: Id7b1e2e9ca97aeff786e9df06f35eca67dd36b58
This commit is contained in:
parent
76a920aed2
commit
c392814ca8
@ -789,13 +789,15 @@ class PXEAnacondaDeployTestCase(db_base.DbTestCase):
|
||||
task.driver.deploy.prepare(task)
|
||||
mock_prepare_instance.assert_called_once_with(mock.ANY, task)
|
||||
|
||||
@mock.patch.object(dhcp_factory.DHCPFactory, 'clean_dhcp', autospec=True)
|
||||
@mock.patch.object(boot_mode_utils, 'configure_secure_boot_if_needed',
|
||||
autospec=True)
|
||||
@mock.patch.object(pxe_utils, 'clean_up_pxe_env', autospec=True)
|
||||
@mock.patch.object(pxe_utils, 'get_instance_image_info', autospec=True)
|
||||
@mock.patch.object(deploy_utils, 'try_set_boot_device', autospec=True)
|
||||
def test_reboot_to_instance(self, mock_set_boot_dev, mock_image_info,
|
||||
mock_cleanup_pxe_env, mock_conf_sec_boot):
|
||||
mock_cleanup_pxe_env, mock_conf_sec_boot,
|
||||
mock_dhcp):
|
||||
image_info = {'kernel': ('', '/path/to/kernel'),
|
||||
'ramdisk': ('', '/path/to/ramdisk'),
|
||||
'stage2': ('', '/path/to/stage2'),
|
||||
@ -810,6 +812,8 @@ class PXEAnacondaDeployTestCase(db_base.DbTestCase):
|
||||
mock_conf_sec_boot.assert_called_once_with(task)
|
||||
mock_cleanup_pxe_env.assert_called_once_with(task, image_info,
|
||||
ipxe_enabled=False)
|
||||
mock_dhcp.assert_has_calls([
|
||||
mock.call(mock.ANY, task)])
|
||||
|
||||
@mock.patch.object(objects.node.Node, 'touch_provisioning', autospec=True)
|
||||
def test_heartbeat_deploy_start(self, mock_touch):
|
||||
|
Loading…
Reference in New Issue
Block a user