Mock _wait_for_interface in test_run_with_sleep
When running unit tests in an environment without network access,
for example in a packaging env, test_run_with_sleep fails with a
timeout trying to list the network interfaces [1].
Mocking the _wait_for_interface call, as it is done currently on
master and stable/pike, fixes the issue. The original commit is
fdcb0922a5c4a4ecbb8cb1b307c6c750990699ff; this patch only grabs
the one mock from the original change.
[1] - See 8a70c4d575
_aa5406af/rpmbuild.log
Change-Id: I5010ea78b4794afb72f86762b7e6fc31c1540436
This commit is contained in:
parent
8a70c4d575
commit
5707c35b41
|
@ -370,11 +370,14 @@ class TestBaseAgent(test_base.BaseTestCase):
|
|||
@mock.patch('ironic_python_agent.hardware_managers.cna._detect_cna_card',
|
||||
autospec=True)
|
||||
@mock.patch.object(time, 'sleep', autospec=True)
|
||||
@mock.patch.object(agent.IronicPythonAgent, '_wait_for_interface',
|
||||
autospec=True)
|
||||
@mock.patch('wsgiref.simple_server.make_server', autospec=True)
|
||||
@mock.patch.object(hardware, '_check_for_iscsi', autospec=True)
|
||||
@mock.patch.object(hardware.HardwareManager, 'list_hardware_info')
|
||||
def test_run_with_sleep(self, mock_check_for_iscsi, mock_list_hardware,
|
||||
mock_make_server, mock_sleep, mock_cna):
|
||||
mock_make_server, mock_wait, mock_sleep,
|
||||
mock_cna):
|
||||
CONF.set_override('inspection_callback_url', '', enforce_type=True)
|
||||
wsgi_server = mock_make_server.return_value
|
||||
wsgi_server.start.side_effect = KeyboardInterrupt()
|
||||
|
|
Loading…
Reference in New Issue