diff options
author | Vladyslav Drok <vdrok@mirantis.com> | 2019-11-26 12:51:40 +0100 |
---|---|---|
committer | Riccardo Pittau <elfosardo@gmail.com> | 2019-11-28 09:39:08 +0000 |
commit | a364ceb615d6ade13a4fc12ea32251fb343ee855 (patch) | |
tree | 882a272cdb9820ed35211aecca2c79cad85d42ce /ironic/tests/unit/drivers/modules/test_agent_client.py | |
parent | 1a65a657cd6eeec8054c1c0f3cbacd8ffe79d707 (diff) | |
download | ironic-a364ceb615d6ade13a4fc12ea32251fb343ee855.tar.gz |
Add timeout when querying agent's command statuses
Otherwise the node can get locked up for a significant amount of time.
It conforms to the behaviour of all other (POST) HTTP requests done to
agent.
Story: 2006946
Task: 37626
Change-Id: I968606a300bc43675d7bd07f73de37967ef80c26
(cherry picked from commit 33a84d94eb4d495312e3ba750b194213737a8933)
Diffstat (limited to 'ironic/tests/unit/drivers/modules/test_agent_client.py')
-rw-r--r-- | ironic/tests/unit/drivers/modules/test_agent_client.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ironic/tests/unit/drivers/modules/test_agent_client.py b/ironic/tests/unit/drivers/modules/test_agent_client.py index 1c563f7fd..4a5d6f89f 100644 --- a/ironic/tests/unit/drivers/modules/test_agent_client.py +++ b/ironic/tests/unit/drivers/modules/test_agent_client.py @@ -21,10 +21,14 @@ import six from six.moves import http_client from ironic.common import exception +from ironic import conf from ironic.drivers.modules import agent_client from ironic.tests import base +CONF = conf.CONF + + class MockResponse(object): def __init__(self, text, status_code=http_client.OK): assert isinstance(text, six.string_types) @@ -181,6 +185,12 @@ class TestAgentClient(base.TestCase): res.json.return_value = {'commands': []} mock_get.return_value = res self.assertEqual([], self.client.get_commands_status(self.node)) + agent_url = self.node.driver_internal_info.get('agent_url') + mock_get.assert_called_once_with( + '%(agent_url)s/%(api_version)s/commands' % { + 'agent_url': agent_url, + 'api_version': CONF.agent.agent_api_version}, + timeout=CONF.agent.command_timeout) def test_prepare_image(self): self.client._command = mock.MagicMock(spec_set=[]) |