Stabilize test_live_migration_abort func test

The test_live_migration_abort test step in the
test_live_migration_actions notification sample test was unstable.
The test starts a live migration and then deletes the migration object
via the REST API to abort it. The test randomly failed to find the
migration object on the REST API. Based on the comparision of the logs
of the successful and unsuccesful runs it was visible that in the
unsuccesful case the test gave up to wait for the migration object too
early. In a succesful run it took 1.5 seconds after the the migration
API call to have the migration object appear on the API while in an
unsuccessful case the test gave up after 1 second.

This early give up was cause by the fact that the loop trying to
get a migration does not applied any delay between such trials and
therefore the 20 attempts run out quickly.

This patch introduces a short sleep between trials to stabilize the
test.

Change-Id: I6be3b236d8eadcde5714c08069708dff303dfd4d
Closes-Bug: #1736976
This commit is contained in:
Balazs Gibizer 2017-12-12 16:33:55 +01:00
parent 32c8ac6b7d
commit 937db90146
1 changed files with 2 additions and 0 deletions

View File

@ -13,6 +13,7 @@
# under the License.
import os
import time
from oslo_config import cfg
from oslo_serialization import jsonutils
@ -265,3 +266,4 @@ class NotificationSampleTestBase(test.TestCase,
return migrations
if retries == max_retries:
self.fail('The migration table left empty.')
time.sleep(0.5)