Merge "Fixed the LP bug 993739."
diff --git a/tempest/tests/test_servers.py b/tempest/tests/test_servers.py
index 414d58a..b152b4c 100644
--- a/tempest/tests/test_servers.py
+++ b/tempest/tests/test_servers.py
@@ -54,58 +54,65 @@
password should be set to that password.
"""
- name = rand_name('server')
- resp, server = self.client.create_server(name, self.image_ref,
+ try:
+ name = rand_name('server')
+ resp, server = self.client.create_server(name, self.image_ref,
self.flavor_ref,
adminPass='testpassword')
- #Verify the password is set correctly in the response
- self.assertEqual('testpassword', server['adminPass'])
+ #Verify the password is set correctly in the response
+ self.assertEqual('testpassword', server['adminPass'])
#Teardown
- self.client.delete_server(server['id'])
+ finally:
+ self.client.delete_server(server['id'])
@attr(type='smoke')
def test_update_server_name(self):
"""The server name should be changed to the the provided value"""
- name = rand_name('server')
- resp, server = self.client.create_server(name, self.image_ref,
+ try:
+ name = rand_name('server')
+ resp, server = self.client.create_server(name, self.image_ref,
self.flavor_ref)
- self.client.wait_for_server_status(server['id'], 'ACTIVE')
+ self.client.wait_for_server_status(server['id'], 'ACTIVE')
- #Update the server with a new name
- resp, server = self.client.update_server(server['id'], name='newname')
- self.assertEquals(200, resp.status)
- self.client.wait_for_server_status(server['id'], 'ACTIVE')
+ #Update the server with a new name
+ resp, server = self.client.update_server(server['id'],
+ name='newname')
+ self.assertEquals(200, resp.status)
+ self.client.wait_for_server_status(server['id'], 'ACTIVE')
- #Verify the name of the server has changed
- resp, server = self.client.get_server(server['id'])
- self.assertEqual('newname', server['name'])
+ #Verify the name of the server has changed
+ resp, server = self.client.get_server(server['id'])
+ self.assertEqual('newname', server['name'])
#Teardown
- self.client.delete_server(server['id'])
+ finally:
+ self.client.delete_server(server['id'])
@attr(type='smoke')
def test_update_access_server_address(self):
"""
The server's access addresses should reflect the provided values
"""
- name = rand_name('server')
- resp, server = self.client.create_server(name, self.image_ref,
+ try:
+ name = rand_name('server')
+ resp, server = self.client.create_server(name, self.image_ref,
self.flavor_ref)
- self.client.wait_for_server_status(server['id'], 'ACTIVE')
+ self.client.wait_for_server_status(server['id'], 'ACTIVE')
- #Update the IPv4 and IPv6 access addresses
- resp, body = self.client.update_server(server['id'],
+ #Update the IPv4 and IPv6 access addresses
+ resp, body = self.client.update_server(server['id'],
accessIPv4='1.1.1.1',
accessIPv6='::babe:2.2.2.2')
- self.assertEqual(200, resp.status)
- self.client.wait_for_server_status(server['id'], 'ACTIVE')
+ self.assertEqual(200, resp.status)
+ self.client.wait_for_server_status(server['id'], 'ACTIVE')
- #Verify the access addresses have been updated
- resp, server = self.client.get_server(server['id'])
- self.assertEqual('1.1.1.1', server['accessIPv4'])
- self.assertEqual('::babe:2.2.2.2', server['accessIPv6'])
+ #Verify the access addresses have been updated
+ resp, server = self.client.get_server(server['id'])
+ self.assertEqual('1.1.1.1', server['accessIPv4'])
+ self.assertEqual('::babe:2.2.2.2', server['accessIPv6'])
#Teardown
- self.client.delete_server(server['id'])
+ finally:
+ self.client.delete_server(server['id'])