From 2bbec5770c459b339b0924e8ffcd1382e22d44df Mon Sep 17 00:00:00 2001 From: Jay Faulkner Date: Fri, 19 Dec 2014 13:24:21 -0800 Subject: Allow use of multiple simultaneous HW managers Currently we pick the most specific manager and use it. Instead, call each method on each hardware manager in priority order, and consider the call successful if the method exists and doesn't throw IncompatibleHardwareMethodError. This is an API breaking change for anyone with out-of-tree HardwareManagers. Closes-bug: 1408469 Change-Id: I30c65c9259acd4f200cb554e7d688344b7486a58 --- ironic_python_agent/tests/agent.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'ironic_python_agent/tests/agent.py') diff --git a/ironic_python_agent/tests/agent.py b/ironic_python_agent/tests/agent.py index a3622bbb..f11473e4 100644 --- a/ironic_python_agent/tests/agent.py +++ b/ironic_python_agent/tests/agent.py @@ -201,7 +201,15 @@ class TestBaseAgent(test_base.BaseTestCase): @mock.patch('os.read') @mock.patch('select.poll') @mock.patch('time.sleep', return_value=None) - def test_ipv4_lookup(self, mock_time_sleep, mock_poll, mock_read): + @mock.patch.object(hardware.GenericHardwareManager, + 'list_network_interfaces') + @mock.patch.object(hardware.GenericHardwareManager, 'get_ipv4_addr') + def test_ipv4_lookup(self, + mock_get_ipv4, + mock_list_net, + mock_time_sleep, + mock_poll, + mock_read): homeless_agent = agent.IronicPythonAgent('https://fake_api.example.' 'org:8081/', (None, 9990), @@ -214,10 +222,6 @@ class TestBaseAgent(test_base.BaseTestCase): 'agent_ipmitool', False) - homeless_agent.hardware = mock.Mock() - mock_list_net = homeless_agent.hardware.list_network_interfaces - mock_get_ipv4 = homeless_agent.hardware.get_ipv4_addr - mock_poll.return_value.poll.return_value = True mock_read.return_value = 'a' -- cgit v1.2.1