Fix bugs in functional tests

- Dont cache management address of appliances
- Wait for nova instance status==active before asserting router status
- Wait a full config_timeout (600s) for rebuild
- Also look for ha router interfaces when cleaning up

Change-Id: I69341c6abee4e36b10f8e9b676587babe861f0c0
This commit is contained in:
Adam Gandelman 2016-03-28 19:50:25 -07:00
parent 93ecf4dbca
commit f4cfb48080
3 changed files with 10 additions and 9 deletions

View File

@ -412,7 +412,11 @@ class TestTenant(object):
LOG.debug('Cleaning up created neutron resources')
router_interface_ports = [
p for p in self.clients.neutronclient.list_ports()['ports']
if 'router_interface' in p['device_owner']]
if (
'router_interface' in p['device_owner'] or
'ha_router_replicated_interface' in p['device_owner']
)]
for rip in router_interface_ports:
LOG.debug('Deleting router interface port: %s', rip)
self.clients.neutronclient.remove_interface_router(
@ -521,7 +525,6 @@ class AstaraFunctionalBase(testtools.TestCase):
parse_config()
self.ak_client = astara_client
self.admin_clients = AdminClientManager()
self._management_address = None
@classmethod
def setUpClass(cls):
@ -553,19 +556,17 @@ class AstaraFunctionalBase(testtools.TestCase):
def get_management_address(self, router_uuid):
LOG.debug('Getting management address for resource %s', router_uuid)
if self._management_address:
return self._management_address['addr']
service_instance = self.get_router_appliance_server(router_uuid)
try:
self._management_address = service_instance.addresses['mgt'][0]
management_address = service_instance.addresses['mgt'][0]
except KeyError:
raise Exception(
'"mgt" port not found on service instance %s (%s)' %
(service_instance.id, service_instance.name))
LOG.debug('Got management address for resource %s', router_uuid)
return self._management_address['addr']
return management_address['addr']
def assert_router_is_active(self, router_uuid, ha_router=False):
LOG.debug('Waiting for resource %s to become ACTIVE', router_uuid)
@ -577,7 +578,7 @@ class AstaraFunctionalBase(testtools.TestCase):
return
service_instances = self.get_router_appliance_server(
router_uuid, ha_router=ha_router)
router_uuid, wait_for_active=True, ha_router=ha_router)
if not ha_router:
service_instances = [service_instances]

View File

@ -122,7 +122,7 @@ class TestAstaraRouter(AstaraRouterTestBase):
# look for the new server, retry giving rug time to do its thing.
new_server = self.get_router_appliance_server(
self.router['id'], retries=60, wait_for_active=True)
self.router['id'], retries=600, wait_for_active=True)
LOG.debug('Rebuilt new server found: %s', new_server)
self.assertNotEqual(old_server.id, new_server.id)

View File

@ -51,7 +51,7 @@ function configure_astara() {
# NOTE(adam_g) When running in the gate on slow VMs, gunicorn workers in the appliance
# sometimes hang during config update and eventually timeout after 60s. Update
# config_timeout in the RUG to reflect that timeout.
iniset $ASTARA_CONF DEFAULT config_timeout 60
iniset $ASTARA_CONF DEFAULT config_timeout 600
iniset $ASTARA_CONF DEFAULT enabled_drivers $ASTARA_ENABLED_DRIVERS