Merge "Fix compile_amphora_details when using UDP listeners" into stable/xena
This commit is contained in:
commit
74cd04d171
@ -112,7 +112,7 @@ class AmphoraInfo(object):
|
||||
def _count_lvs_listener_processes(self, lvs_driver, listener_list):
|
||||
num = 0
|
||||
for listener_id in listener_list:
|
||||
if lvs_driver.is_listener_running(listener_id):
|
||||
if util.is_lvs_listener_running(listener_id):
|
||||
# optional check if it's still running
|
||||
num += 1
|
||||
return num
|
||||
|
@ -182,6 +182,8 @@ class TestAmphoraInfo(base.TestCase):
|
||||
self.assertEqual(expected_dict, actual.json)
|
||||
api_server.VERSION = original_version
|
||||
|
||||
@mock.patch('octavia.amphorae.backends.agent.api_server.util.'
|
||||
'is_lvs_listener_running')
|
||||
@mock.patch('octavia.amphorae.backends.agent.api_server.util.'
|
||||
'get_lvs_listeners',
|
||||
return_value=[FAKE_LISTENER_ID_3, FAKE_LISTENER_ID_4])
|
||||
@ -205,7 +207,8 @@ class TestAmphoraInfo(base.TestCase):
|
||||
m_pkg_version, m_load,
|
||||
m_get_nets,
|
||||
m_os, m_cpu, mget_mem,
|
||||
mock_get_lb, mget_lvs_listener):
|
||||
mock_get_lb, mget_lvs_listener,
|
||||
mock_is_lvs_listener_running):
|
||||
mget_mem.return_value = {'SwapCached': 0, 'Buffers': 344792,
|
||||
'MemTotal': 21692784, 'Cached': 4271856,
|
||||
'Slab': 534384, 'MemFree': 12685624,
|
||||
@ -227,7 +230,7 @@ class TestAmphoraInfo(base.TestCase):
|
||||
m_count.return_value = 5
|
||||
self.lvs_driver.get_subscribed_amp_compile_info.return_value = [
|
||||
'keepalived', 'ipvsadm']
|
||||
self.lvs_driver.is_listener_running.side_effect = [True, False]
|
||||
mock_is_lvs_listener_running.side_effect = [True, False]
|
||||
mock_get_lb.return_value = [self.LB_ID_1]
|
||||
original_version = api_server.VERSION
|
||||
api_server.VERSION = self.API_VERSION
|
||||
@ -282,8 +285,10 @@ class TestAmphoraInfo(base.TestCase):
|
||||
[uuidutils.generate_uuid(), uuidutils.generate_uuid()])
|
||||
self.assertEqual(1, result)
|
||||
|
||||
def test__count_lvs_listener_processes(self):
|
||||
self.lvs_driver.is_listener_running.side_effect = [True, False, True]
|
||||
@mock.patch('octavia.amphorae.backends.agent.api_server.util.'
|
||||
'is_lvs_listener_running')
|
||||
def test__count_lvs_listener_processes(self, mock_is_lvs_listener_running):
|
||||
mock_is_lvs_listener_running.side_effect = [True, False, True]
|
||||
expected = 2
|
||||
actual = self.amp_info._count_lvs_listener_processes(
|
||||
self.lvs_driver, [self.FAKE_LISTENER_ID_1,
|
||||
|
Loading…
Reference in New Issue
Block a user