summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Pena <jpena@redhat.com>2017-10-18 10:28:19 +0200
committerRuby Loo <ruby.loo@intel.com>2017-10-18 15:27:45 +0000
commit5707c35b4186395e9dfb7818656d8e4929f0613c (patch)
tree2905a1e4f4143ff08bb5d7fd222218cad5ef5e1d
parent8a70c4d575c3b5bef2debde8512ed3200ccc8d4c (diff)
downloadironic-python-agent-2.0.1.tar.gz
Mock _wait_for_interface in test_run_with_sleep2.0.1
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 https://trunk.rdoproject.org/centos7-ocata/8a/70/8a70c4d575c3b5bef2debde8512ed3200ccc8d4c_aa5406af/rpmbuild.log Change-Id: I5010ea78b4794afb72f86762b7e6fc31c1540436
-rw-r--r--ironic_python_agent/tests/unit/test_agent.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/ironic_python_agent/tests/unit/test_agent.py b/ironic_python_agent/tests/unit/test_agent.py
index 0b8ddc0e..f3a3b245 100644
--- a/ironic_python_agent/tests/unit/test_agent.py
+++ b/ironic_python_agent/tests/unit/test_agent.py
@@ -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()