Fix Octavia no 'loadbalancer' AttributeError

This patch fixes Octavia AttributeError has no attribute 'loadbalancer'
on test_faults.

Change-Id: I367c8117f6d042693704f700676620cb345b2ea4
This commit is contained in:
Omer 2021-11-03 14:31:11 +01:00 committed by Omer Schwartz
parent 7af23e5159
commit eb9fb0a05a
2 changed files with 10 additions and 11 deletions

View File

@ -105,19 +105,21 @@ class OctaviaLoadbalancerStackFixture(heat.HeatStackFixture):
else: else:
return self.vip_network.ipv6_subnet_id return self.vip_network.ipv6_subnet_id
def wait_for_active_loadbalancer(self, **kwargs): def wait_for_active_loadbalancer(self):
loadbalancer_id = self.stack.output_show(
'loadbalancer_id')['output']['output_value']
octavia.wait_for_status(status_key=octavia.PROVISIONING_STATUS, octavia.wait_for_status(status_key=octavia.PROVISIONING_STATUS,
status=octavia.ACTIVE, status=octavia.ACTIVE,
get_client=octavia.get_loadbalancer, get_client=octavia.get_loadbalancer,
object_id=self.loadbalancer.loadbalancer_id, object_id=loadbalancer_id)
**kwargs)
def wait_for_update_loadbalancer(self, **kwargs): def wait_for_update_loadbalancer(self):
loadbalancer_id = self.stack.output_show(
'loadbalancer_id')['output']['output_value']
octavia.wait_for_status(status_key=octavia.PROVISIONING_STATUS, octavia.wait_for_status(status_key=octavia.PROVISIONING_STATUS,
status=octavia.PENDING_UPDATE, status=octavia.PENDING_UPDATE,
get_client=octavia.get_loadbalancer, get_client=octavia.get_loadbalancer,
object_id=self.loadbalancer.loadbalancer_id, object_id=loadbalancer_id)
**kwargs)
class OctaviaListenerStackFixture(heat.HeatStackFixture): class OctaviaListenerStackFixture(heat.HeatStackFixture):

View File

@ -90,9 +90,7 @@ class OctaviaBasicFaultTest(testtools.TestCase):
# Wait for the LB to be updated # Wait for the LB to be updated
try: try:
self.loadbalancer_stack.wait_for_update_loadbalancer( self.loadbalancer_stack.wait_for_update_loadbalancer(timeout=30)
loadbalancer_id=self.loadbalancer_stack.loadbalancer_id,
timeout=30)
except tobiko.RetryTimeLimitError: except tobiko.RetryTimeLimitError:
LOG.info('The restarted servers reached ACTIVE status after the' LOG.info('The restarted servers reached ACTIVE status after the'
@ -100,8 +98,7 @@ class OctaviaBasicFaultTest(testtools.TestCase):
' being raised even though the update timeout was' ' being raised even though the update timeout was'
' reached.') ' reached.')
self.loadbalancer_stack.wait_for_active_loadbalancer( self.loadbalancer_stack.wait_for_active_loadbalancer()
loadbalancer_id=self.loadbalancer_stack.loadbalancer_id)
LOG.debug(f'Load Balancer {self.loadbalancer_stack.loadbalancer_id} is' LOG.debug(f'Load Balancer {self.loadbalancer_stack.loadbalancer_id} is'
f' ACTIVE') f' ACTIVE')