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
diff --git a/neutron/tests/tempest/api/base.py b/neutron/tests/tempest/api/base.py
index 3fc61cb..6eb2986 100644
--- a/neutron/tests/tempest/api/base.py
+++ b/neutron/tests/tempest/api/base.py
@@ -99,6 +99,7 @@
cls.networks = []
cls.admin_networks = []
cls.subnets = []
+ cls.admin_subnets = []
cls.ports = []
cls.routers = []
cls.floating_ips = []
@@ -154,6 +155,10 @@
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 @@
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