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

This commit is contained in:
Zuul 2020-05-12 00:49:43 +00:00 committed by Gerrit Code Review
commit 126ad303ac
3 changed files with 13 additions and 7 deletions

View File

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

View File

@ -37,7 +37,9 @@ class NoopManager(object):
super(NoopManager, self).__init__()
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:
LOG.debug("Amphora noop driver update_amphora_listeners, "
"listener %s, amphora %s, timeouts %s", listener.id,
@ -114,10 +116,11 @@ class NoopAmphoraLoadBalancerDriver(
super(NoopAmphoraLoadBalancerDriver, self).__init__()
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,
timeout_dict)
self.driver.update_amphora_listeners(listeners, amphora_index,
amphorae, timeout_dict)
def update(self, listener, vip):

View File

@ -69,7 +69,8 @@ class TestNoopAmphoraLoadBalancerDriver(base.TestCase):
constants.CONN_RETRY_INTERVAL: 4}
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.assertEqual((self.listener, self.amphora.id, self.timeout_dict,
'update_amp'),