Tempest: Fix cleaning of subnets

Similar to I52428262276c16dbe077fcf77b1890f12dccc97d,
any subnets created with another client were failing to delete
with an HTTPNotFound which was silently ignored. So
we were implicitly depending on deletion of the network to
actually cleanup the subnet.

This adjusts the logic to use the admin_client to delete the subnet
whenever a different client is used.

Change-Id: Ie7d733a501b87fd2334054e72c86b8dae36da37c
This commit is contained in:
Kevin Benton
2017-09-01 17:13:01 -07:00
committed by garyk
parent 86d80ee336
commit ba3651cbaa
+9 -1
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