Merge "Fix the amphora noop driver" into stable/queens

This commit is contained in:
Zuul 2020-05-06 13:56:32 +00:00 committed by Gerrit Code Review
commit 299c54a5de
3 changed files with 13 additions and 7 deletions

View File

@ -64,8 +64,10 @@ class HaproxyAmphoraLoadBalancerDriver(
:param listeners: List of listeners to update. :param listeners: List of listeners to update.
:type listener: list :type listener: list
:param amphora_id: The ID of the amphora to update :param amphora_index: The index of the amphora to update
:type amphora_id: string :type amphora_index: integer
:param amphorae: List of amphorae
:type amphorae: list
:param timeout_dict: Dictionary of timeout values for calls to the :param timeout_dict: Dictionary of timeout values for calls to the
amphora. May contain: req_conn_timeout, amphora. May contain: req_conn_timeout,
req_read_timeout, conn_max_retries, req_read_timeout, conn_max_retries,

View File

@ -37,7 +37,9 @@ class NoopManager(object):
super(NoopManager, self).__init__() super(NoopManager, self).__init__()
self.amphoraconfig = {} self.amphoraconfig = {}
def update_amphora_listeners(self, listeners, amphora_id, timeout_dict): def update_amphora_listeners(self, listeners, amphora_index,
amphorae, timeout_dict):
amphora_id = amphorae[amphora_index].id
for listener in listeners: for listener in listeners:
LOG.debug("Amphora noop driver update_amphora_listeners, " LOG.debug("Amphora noop driver update_amphora_listeners, "
"listener %s, amphora %s, timeouts %s", listener.id, "listener %s, amphora %s, timeouts %s", listener.id,
@ -114,10 +116,11 @@ class NoopAmphoraLoadBalancerDriver(
super(NoopAmphoraLoadBalancerDriver, self).__init__() super(NoopAmphoraLoadBalancerDriver, self).__init__()
self.driver = NoopManager() self.driver = NoopManager()
def update_amphora_listeners(self, listeners, amphora_id, timeout_dict): def update_amphora_listeners(self, listeners, amphora_index,
amphorae, timeout_dict):
self.driver.update_amphora_listeners(listeners, amphora_id, self.driver.update_amphora_listeners(listeners, amphora_index,
timeout_dict) amphorae, timeout_dict)
def update(self, listener, vip): def update(self, listener, vip):

View File

@ -69,7 +69,8 @@ class TestNoopAmphoraLoadBalancerDriver(base.TestCase):
constants.CONN_RETRY_INTERVAL: 4} constants.CONN_RETRY_INTERVAL: 4}
def test_update_amphora_listeners(self): def test_update_amphora_listeners(self):
self.driver.update_amphora_listeners([self.listener], self.amphora.id, amphorae = [self.amphora]
self.driver.update_amphora_listeners([self.listener], 0, amphorae,
self.timeout_dict) self.timeout_dict)
self.assertEqual((self.listener, self.amphora.id, self.timeout_dict, self.assertEqual((self.listener, self.amphora.id, self.timeout_dict,
'update_amp'), 'update_amp'),