Prevent init_host test to interfere with other tests

The test_migrate_disk_and_power_off_crash_finish_revert_migration test
needs to simulate a compute host crash at a certain point. It stops the
execution at a certain point by injecting a sleep then simulating a
compute restart. However the sleep is just 30 seconds which allows the
stopped function to return while other functional tests are running in
the same test worker process making those tests fail in a weird way.

One simple solution is to add a big enough sleep to the test that will
never return before the whole functional test execution. This patch
proposes a million seconds which is more than 277 hours. Similar to how
the other test in this test package works. This solution is hacky but
simple. A better solution would be to further enhance the capabilities
of the functional test env supporting nova-compute service crash / kill
+ restart.

Change-Id: Ib0d142806804e9113dd61d3a7ec15a98232775c8
Closes-Bug: #1839515
This commit is contained in:
Balazs Gibizer 2019-08-09 09:53:45 +02:00 committed by Matt Riedemann
parent 5294af8b92
commit f875c9d12f
1 changed files with 3 additions and 3 deletions

View File

@ -13,7 +13,6 @@
import mock
import time
import testtools
from nova import context as nova_context
from nova import objects
@ -28,7 +27,6 @@ class ComputeManagerInitHostTestCase(
compute_driver = 'fake.MediumFakeDriver'
@testtools.skip('Bug 1839515')
def test_migrate_disk_and_power_off_crash_finish_revert_migration(self):
"""Tests the scenario that the compute service crashes while the
driver's migrate_disk_and_power_off method is running (we could be
@ -57,7 +55,9 @@ class ComputeManagerInitHostTestCase(
# fail and set the instance to ERROR status, revert allocations,
# etc which is not realistic if the service actually crashed while
# migrate_disk_and_power_off was running.
time.sleep(30)
# The sleep value needs to be large to avoid this waking up and
# interfering with other tests running on the same worker.
time.sleep(1000000)
source_driver = self.computes[source_host].manager.driver
with mock.patch.object(source_driver, 'migrate_disk_and_power_off',