functional: Make '_wait_for_state_change' behave consistently

Both 'ServersTestBase' and 'InstanceHelperMixin' provide implementations
of '_wait_for_state_change' but they behave differently. The former
waits for an instance to transition *from* the provided state, while the
latter, somewhat more sanely, waits for the transition *to* the provided
state. Switch to using the latter everywhere and make the necessary
changes. Due to class hierarchies, we end up with two nearly identical
implementations but these will be merged in a future change.

Change-Id: I80cdc0a33ec27b1389130c22f9c3a8ff69f6b1a0
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane
2019-11-14 11:21:54 +00:00
parent 0138fb1ada
commit 431237d2ee
11 changed files with 114 additions and 202 deletions

View File

@@ -38,10 +38,7 @@ class InstanceActionsTestV2(test_servers.ServersTestBase):
found_server = self.api.get_server(created_server_id)
self.assertEqual(created_server_id, found_server['id'])
found_server = self._wait_for_state_change(found_server, 'BUILD')
# It should be available...
self.assertEqual('ACTIVE', found_server['status'])
return found_server
return self._wait_for_state_change(found_server, 'ACTIVE')
def test_get_instance_actions(self):
server = self._create_server()