Merge "Tempest: Fix cleaning of subnets"

This commit is contained in:
Jenkins 2017-09-05 18:50:42 +00:00 committed by Gerrit Code Review
commit 91bee6dcdd

View File

@ -99,6 +99,7 @@ class BaseNetworkTest(test.BaseTestCase):
cls.networks = []
cls.admin_networks = []
cls.subnets = []
cls.admin_subnets = []
cls.ports = []
cls.routers = []
cls.floating_ips = []
@ -154,6 +155,10 @@ class BaseNetworkTest(test.BaseTestCase):
for subnet in cls.subnets:
cls._try_delete_resource(cls.client.delete_subnet,
subnet['id'])
# Clean up admin subnets
for subnet in cls.admin_subnets:
cls._try_delete_resource(cls.admin_client.delete_subnet,
subnet['id'])
# Clean up networks
for network in cls.networks:
cls._try_delete_resource(cls.client.delete_network,
@ -308,7 +313,10 @@ class BaseNetworkTest(test.BaseTestCase):
message = 'Available CIDR for subnet creation could not be found'
raise ValueError(message)
subnet = body['subnet']
cls.subnets.append(subnet)
if client is cls.client:
cls.subnets.append(subnet)
else:
cls.admin_subnets.append(subnet)
return subnet
@classmethod