From fe6b6879689a0d793ee22ac9ba7155488f1d6a88 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Fri, 18 Sep 2020 17:52:49 +0200 Subject: When reporting that agent is busy, report the executed command Also make this API return a proper HTTP code (409 instead of 500). Change-Id: I5d86878b5ed6142ed2630adee78c0867c49b663f --- ironic_python_agent/tests/unit/extensions/test_base.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ironic_python_agent/tests') diff --git a/ironic_python_agent/tests/unit/extensions/test_base.py b/ironic_python_agent/tests/unit/extensions/test_base.py index 2881d2ab..f609e580 100644 --- a/ironic_python_agent/tests/unit/extensions/test_base.py +++ b/ironic_python_agent/tests/unit/extensions/test_base.py @@ -117,6 +117,17 @@ class TestExecuteCommandMixin(test_base.IronicAgentTest): result.command_status) self.assertEqual(exc, result.command_error) + def test_busy(self): + fake_extension = FakeExtension() + self.agent.ext_mgr = extension.ExtensionManager.make_test_instance( + [extension.Extension('fake', None, FakeExtension, fake_extension)]) + + self.agent.command_results = { + 'fake': base.BaseCommandResult('name', {}) + } + self.assertRaises(errors.AgentIsBusy, + self.agent.execute_command, 'fake.fake_sync_command') + class TestExtensionDecorators(test_base.IronicAgentTest): def setUp(self): -- cgit v1.2.1