diff options
author | Joseph Lanoux <joseph.lanoux@hp.com> | 2014-10-17 14:56:56 +0000 |
---|---|---|
committer | Matt Riedemann <mriedem@us.ibm.com> | 2014-10-17 13:27:46 -0700 |
commit | e59f0fffb28a1b98476e3cc7dfaaed33f469711b (patch) | |
tree | 08f4c1bf09c75f6411a2dbace4f72a4314e56ad4 | |
parent | be6d79ef65e1acf25ebfcbd27fa8c4a4f6282d46 (diff) | |
download | tempest-e59f0fffb28a1b98476e3cc7dfaaed33f469711b.tar.gz |
Add cleanup to test_verify_multiple_nics_order
This test doesn't cleanup the networks and subnets that it created. Following
Tempest tests in non-isolated environments are consequently failing because
multiple networks are found. This change deleted those networks and subnets.
Related-Bug: #1329065
Change-Id: Id618aeeb85e3d4767ed07b4d29b908274eba76df
-rw-r--r-- | tempest/api/compute/servers/test_create_server.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py index 25dc87d00..bc452aab4 100644 --- a/tempest/api/compute/servers/test_create_server.py +++ b/tempest/api/compute/servers/test_create_server.py @@ -132,17 +132,27 @@ class ServersTestJSON(base.BaseV2ComputeTest): # preserved within the server. name_net1 = data_utils.rand_name(self.__class__.__name__) _, net1 = self.network_client.create_network(name=name_net1) + self.addCleanup(self.network_client.delete_network, + net1['network']['id']) + name_net2 = data_utils.rand_name(self.__class__.__name__) _, net2 = self.network_client.create_network(name=name_net2) + self.addCleanup(self.network_client.delete_network, + net2['network']['id']) _, subnet1 = self.network_client.create_subnet( network_id=net1['network']['id'], cidr='19.80.0.0/24', ip_version=4) + self.addCleanup(self.network_client.delete_subnet, + subnet1['subnet']['id']) + _, subnet2 = self.network_client.create_subnet( network_id=net2['network']['id'], cidr='19.86.0.0/24', ip_version=4) + self.addCleanup(self.network_client.delete_subnet, + subnet2['subnet']['id']) networks = [{'uuid': net1['network']['id']}, {'uuid': net2['network']['id']}] @@ -150,6 +160,18 @@ class ServersTestJSON(base.BaseV2ComputeTest): _, server_multi_nics = self.create_test_server( networks=networks, wait_until='ACTIVE') + # Cleanup server; this is needed in the test case because with the LIFO + # nature of the cleanups, if we don't delete the server first, the port + # will still be part of the subnet and we'll get a 409 from Neutron + # when trying to delete the subnet. The tear down in the base class + # will try to delete the server and get a 404 but it's ignored so + # we're OK. + def cleanup_server(): + self.client.delete_server(server_multi_nics['id']) + self.client.wait_for_server_termination(server_multi_nics['id']) + + self.addCleanup(cleanup_server) + _, addresses = self.client.list_addresses(server_multi_nics['id']) expected_addr = ['19.80.0.2', '19.86.0.2'] |