Avoid race in test_evacuate

We want the host to be the destination and the status to be active so
use _wait_for_server_parameter to wait on both of those, rather than
waiting only for the server to change to ACTIVE.

Without this, we sometimes see the server go ACTIVE but the host has
not yet changed.

Co-Authored-By: Balazs Gibizer <balazs.gibizer@ericsson.com>
Co-Authored-By: Chris Dent <cdent@anticdent.org>
Change-Id: I273998ebc03f3a832cc44787a5c2396da58e5e25
Closes-Bug: 1710509
This commit is contained in:
jichenjc 2017-08-15 01:16:16 +08:00 committed by Chris Dent
parent a1c0b0f06e
commit 548e93c4b4
1 changed files with 4 additions and 2 deletions

View File

@ -1612,8 +1612,10 @@ class ServerMovingTests(test.TestCase, integrated_helpers.InstanceHelperMixin):
post = {'evacuate': {}}
self.api.post_server_action(
server['id'], post)
server = self._wait_for_state_change(self.api, server, 'ACTIVE')
self.assertEqual(dest_hostname, server['OS-EXT-SRV-ATTR:host'])
expected_params = {'OS-EXT-SRV-ATTR:host': dest_hostname,
'status': 'ACTIVE'}
server = self._wait_for_server_parameter(self.api, server,
expected_params)
# Expect to have allocation and usages on both computes as the
# source compute is still down