Merge "Run negative server moving tests with nested RPs"

This commit is contained in:
Zuul 2018-10-31 10:04:08 +00:00 committed by Gerrit Code Review
commit 063e4132cb
2 changed files with 100 additions and 1 deletions

View File

@ -3430,7 +3430,6 @@ class ServerLiveMigrateForceAndAbort(
self._run_periodics()
allocations = self._get_allocations_by_server_uuid(server['id'])
self.assertEqual(1, len(allocations))
self.assertNotIn(dest_rp_uuid, allocations)
self.assertFlavorMatchesUsage(source_rp_uuid, self.flavor1)
@ -3445,6 +3444,23 @@ class ServerLiveMigrateForceAndAbort(
self._delete_and_check_allocations(server)
class ServerLiveMigrateForceAndAbortWithNestedResourcesRequest(
ServerLiveMigrateForceAndAbort):
compute_driver = 'fake.FakeLiveMigrateDriverWithNestedCustomResources'
def setUp(self):
super(ServerLiveMigrateForceAndAbortWithNestedResourcesRequest,
self).setUp()
# modify the flavor used in the test base class to require one piece of
# CUSTOM_MAGIC resource as well.
self.api.post_extra_spec(
self.flavor1['id'], {'extra_specs': {'resources:CUSTOM_MAGIC': 1}})
# save the extra_specs in the flavor stored in the test case as
# well
self.flavor1['extra_specs'] = {'resources:CUSTOM_MAGIC': 1}
class ServerRescheduleTests(integrated_helpers.ProviderUsageBaseTestCase):
"""Tests server create scenarios which trigger a reschedule during
a server build and validates that allocations in Placement
@ -3500,6 +3516,21 @@ class ServerRescheduleTests(integrated_helpers.ProviderUsageBaseTestCase):
self.assertFlavorMatchesUsage(dest_rp_uuid, self.flavor1)
class ServerRescheduleTestsWithNestedResourcesRequest(ServerRescheduleTests):
compute_driver = 'fake.FakeRescheduleDriverWithNestedCustomResources'
def setUp(self):
super(ServerRescheduleTestsWithNestedResourcesRequest, self).setUp()
# modify the flavor used in the test base class to require one piece of
# CUSTOM_MAGIC resource as well.
self.api.post_extra_spec(
self.flavor1['id'], {'extra_specs': {'resources:CUSTOM_MAGIC': 1}})
# save the extra_specs in the flavor stored in the test case as
# well
self.flavor1['extra_specs'] = {'resources:CUSTOM_MAGIC': 1}
class ServerBuildAbortTests(integrated_helpers.ProviderUsageBaseTestCase):
"""Tests server create scenarios which trigger a build abort during
a server build and validates that allocations in Placement
@ -3539,6 +3570,21 @@ class ServerBuildAbortTests(integrated_helpers.ProviderUsageBaseTestCase):
'DISK_GB': 0}, failed_rp_uuid)
class ServerBuildAbortTestsWithNestedResourceRequest(ServerBuildAbortTests):
compute_driver = 'fake.FakeBuildAbortDriverWithNestedCustomResources'
def setUp(self):
super(ServerBuildAbortTestsWithNestedResourceRequest, self).setUp()
# modify the flavor used in the test base class to require one piece of
# CUSTOM_MAGIC resource as well.
self.api.post_extra_spec(
self.flavor1['id'], {'extra_specs': {'resources:CUSTOM_MAGIC': 1}})
# save the extra_specs in the flavor stored in the test case as
# well
self.flavor1['extra_specs'] = {'resources:CUSTOM_MAGIC': 1}
class ServerUnshelveSpawnFailTests(
integrated_helpers.ProviderUsageBaseTestCase):
"""Tests server unshelve scenarios which trigger a
@ -3604,6 +3650,24 @@ class ServerUnshelveSpawnFailTests(
'DISK_GB': 0}, rp_uuid)
class ServerUnshelveSpawnFailTestsWithNestedResourceRequest(
ServerUnshelveSpawnFailTests):
compute_driver = ('fake.'
'FakeUnshelveSpawnFailDriverWithNestedCustomResources')
def setUp(self):
super(ServerUnshelveSpawnFailTestsWithNestedResourceRequest,
self).setUp()
# modify the flavor used in the test base class to require one piece of
# CUSTOM_MAGIC resource as well.
self.api.post_extra_spec(
self.flavor1['id'], {'extra_specs': {'resources:CUSTOM_MAGIC': 1}})
# save the extra_specs in the flavor stored in the test case as
# well
self.flavor1['extra_specs'] = {'resources:CUSTOM_MAGIC': 1}
class ServerSoftDeleteTests(integrated_helpers.ProviderUsageBaseTestCase):
compute_driver = 'fake.SmallFakeDriver'
@ -3709,6 +3773,21 @@ class ServerSoftDeleteTests(integrated_helpers.ProviderUsageBaseTestCase):
self._delete_and_check_allocations(server)
class ServerSoftDeleteTestsWithNestedResourceRequest(ServerSoftDeleteTests):
compute_driver = 'fake.MediumFakeDriverWithNestedCustomResources'
def setUp(self):
super(ServerSoftDeleteTestsWithNestedResourceRequest, self).setUp()
# modify the flavor used in the test base class to require one piece of
# CUSTOM_MAGIC resource as well.
self.api.post_extra_spec(
self.flavor1['id'], {'extra_specs': {'resources:CUSTOM_MAGIC': 1}})
# save the extra_specs in the flavor stored in the test case as
# well
self.flavor1['extra_specs'] = {'resources:CUSTOM_MAGIC': 1}
class VolumeBackedServerTest(integrated_helpers.ProviderUsageBaseTestCase):
"""Tests for volume-backed servers."""

View File

@ -723,6 +723,11 @@ class FakeRescheduleDriver(FakeDriver):
admin_password, allocations, network_info, block_device_info)
class FakeRescheduleDriverWithNestedCustomResources(
FakeRescheduleDriver, MediumFakeDriverWithNestedCustomResources):
pass
class FakeBuildAbortDriver(FakeDriver):
"""FakeDriver derivative that always fails on spawn() with a
BuildAbortException so no reschedule is attempted.
@ -734,6 +739,11 @@ class FakeBuildAbortDriver(FakeDriver):
instance_uuid=instance.uuid, reason='FakeBuildAbortDriver')
class FakeBuildAbortDriverWithNestedCustomResources(
FakeBuildAbortDriver, MediumFakeDriverWithNestedCustomResources):
pass
class FakeUnshelveSpawnFailDriver(FakeDriver):
"""FakeDriver derivative that always fails on spawn() with a
VirtualInterfaceCreateException when unshelving an offloaded instance.
@ -750,6 +760,11 @@ class FakeUnshelveSpawnFailDriver(FakeDriver):
admin_password, allocations, network_info, block_device_info)
class FakeUnshelveSpawnFailDriverWithNestedCustomResources(
FakeUnshelveSpawnFailDriver, MediumFakeDriverWithNestedCustomResources):
pass
class FakeLiveMigrateDriver(FakeDriver):
"""FakeDriver derivative to handle force_complete and abort calls.
@ -794,3 +809,8 @@ class FakeLiveMigrateDriver(FakeDriver):
migrate_data=None):
if instance.uuid in self.instances:
del self.instances[instance.uuid]
class FakeLiveMigrateDriverWithNestedCustomResources(
FakeLiveMigrateDriver, MediumFakeDriverWithNestedCustomResources):
pass