Use waiter method to check server status

The status of an instance could be 'ACTIVE' right after a lease ends,
since the task of deleting the instance is still in progress.

This patch replaces the assertion to check whether the instance is
terminated with a waiter method. The method periodically checks for the
existance of the specified instance until the instance is deleted.

* Code sync from https://review.openstack.org/#/c/527874/

Change-Id: I32f2ef3ddbb30da8061ccc035aae0428e6dd5450
This commit is contained in:
Chandan Kumar 2018-01-04 22:09:47 +05:30
parent 30323b4d4b
commit cdce28e5bf
1 changed files with 2 additions and 3 deletions

View File

@ -259,9 +259,8 @@ class TestHostReservationScenario(rrs.ResourceReservationScenarioTest):
# check if the lease has been correctly terminated and
# the instance is removed
self.assertRaises(exceptions.NotFound,
self.os_admin.servers_client.show_server,
server['id'])
waiters.wait_for_server_termination(self.os_admin.servers_client,
server['id'])
# check that the host aggregate was deleted
self.assertRaises(exceptions.NotFound,