diff options
| author | Julia Kreger <juliaashleykreger@gmail.com> | 2020-08-10 15:26:29 -0700 |
|---|---|---|
| committer | Julia Kreger <juliaashleykreger@gmail.com> | 2020-09-14 22:38:18 +0000 |
| commit | bb27badf7650ffeb54a6e63efef44f9bba5b6258 (patch) | |
| tree | e4c246ac363bb2725bb6ab3d0bc0fe310efe58dd /ironic_python_agent/tests | |
| parent | f45d2cc0e789614361a5e01f6f254e6188ad8ebd (diff) | |
| download | ironic-python-agent-bb27badf7650ffeb54a6e63efef44f9bba5b6258.tar.gz | |
Add basic retries for inspection
A transitory connection failure, such as one caused by
a port being held down for traffic forwarding, can experience
intermittent connectivity failures which result in failed
introspections.
Now the agent retries.
Change-Id: I72c5e3aca000d3854a17f8a461b1a2935e5c0d9b
Diffstat (limited to 'ironic_python_agent/tests')
| -rw-r--r-- | ironic_python_agent/tests/unit/test_inspector.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ironic_python_agent/tests/unit/test_inspector.py b/ironic_python_agent/tests/unit/test_inspector.py index 900a048a..f3f6f130 100644 --- a/ironic_python_agent/tests/unit/test_inspector.py +++ b/ironic_python_agent/tests/unit/test_inspector.py @@ -191,6 +191,15 @@ class TestCallInspector(base.IronicAgentTest): data='{"data": 42, "error": null}') self.assertIsNone(res) + def test_inspector_retries(self, mock_post): + mock_post.side_effect = requests.exceptions.ConnectionError + failures = utils.AccumulatedFailures() + data = collections.OrderedDict(data=42) + self.assertRaises(requests.exceptions.ConnectionError, + inspector.call_inspector, + data, failures) + self.assertEqual(5, mock_post.call_count) + class BaseDiscoverTest(base.IronicAgentTest): def setUp(self): |
