From ba3651cbaae258a20b11e3a564fe290c33d65494 Mon Sep 17 00:00:00 2001 From: Kevin Benton Date: Fri, 1 Sep 2017 17:13:01 -0700 Subject: [PATCH] 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 --- neutron/tests/tempest/api/base.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/neutron/tests/tempest/api/base.py b/neutron/tests/tempest/api/base.py index 3fc61cbba..6eb298642 100644 --- a/neutron/tests/tempest/api/base.py +++ b/neutron/tests/tempest/api/base.py @@ -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