From 3d063df056058183750329bcd51daa412f0aef77 Mon Sep 17 00:00:00 2001 From: Viktor Tikkanen Date: Fri, 26 Jun 2015 07:55:11 +0300 Subject: [PATCH] Ensure server unlocking after test_lock_unlock_server If assertRaises() in test_lock_unlock_server fails for some reason, the server remains in locked state and cannot be deleted after execution of test cases. addCleanup call for server unlocking is added so that in case of test_lock_unlock_server failure there will be no hanging servers in the system after tempest run. Change-Id: Iff336723d8e03814d9361492b1d5856b785f7a4c Closes-Bug: #1468623 --- tempest/api/compute/servers/test_server_actions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py index f0f6b8c46b..234f7e10e3 100644 --- a/tempest/api/compute/servers/test_server_actions.py +++ b/tempest/api/compute/servers/test_server_actions.py @@ -474,6 +474,7 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest): def test_lock_unlock_server(self): # Lock the server,try server stop(exceptions throw),unlock it and retry self.client.lock_server(self.server_id) + self.addCleanup(self.client.unlock_server, self.server_id) server = self.client.show_server(self.server_id) self.assertEqual(server['status'], 'ACTIVE') # Locked server is not allowed to be stopped by non-admin user