From 937db90146f04783183644bfeff78b1f6bf854b8 Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Tue, 12 Dec 2017 16:33:55 +0100 Subject: [PATCH] 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 --- .../notification_sample_tests/notification_sample_base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nova/tests/functional/notification_sample_tests/notification_sample_base.py b/nova/tests/functional/notification_sample_tests/notification_sample_base.py index c0b4b1abc99b..6adb2d988a2a 100644 --- a/nova/tests/functional/notification_sample_tests/notification_sample_base.py +++ b/nova/tests/functional/notification_sample_tests/notification_sample_base.py @@ -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)