Browse Source

Merge "Create a fixture around fake_notifier"

changes/62/771362/20
Zuul 4 months ago
committed by Gerrit Code Review
parent
commit
620a931813
  1. 1
      nova/tests/fixtures/__init__.py
  2. 39
      nova/tests/fixtures/notifications.py
  3. 12
      nova/tests/functional/compute/test_cache_image.py
  4. 3
      nova/tests/functional/compute/test_init_host.py
  5. 3
      nova/tests/functional/compute/test_live_migration.py
  6. 3
      nova/tests/functional/compute/test_resource_tracker.py
  7. 27
      nova/tests/functional/integrated_helpers.py
  8. 7
      nova/tests/functional/libvirt/test_evacuate.py
  9. 4
      nova/tests/functional/libvirt/test_numa_servers.py
  10. 5
      nova/tests/functional/libvirt/test_pci_sriov_servers.py
  11. 29
      nova/tests/functional/notification_sample_tests/notification_sample_base.py
  12. 55
      nova/tests/functional/notification_sample_tests/test_aggregate.py
  13. 23
      nova/tests/functional/notification_sample_tests/test_compute_task.py
  14. 7
      nova/tests/functional/notification_sample_tests/test_exception_notification.py
  15. 13
      nova/tests/functional/notification_sample_tests/test_flavor.py
  16. 417
      nova/tests/functional/notification_sample_tests/test_instance.py
  17. 19
      nova/tests/functional/notification_sample_tests/test_keypair.py
  18. 5
      nova/tests/functional/notification_sample_tests/test_libvirt.py
  19. 5
      nova/tests/functional/notification_sample_tests/test_metrics.py
  20. 17
      nova/tests/functional/notification_sample_tests/test_server_group.py
  21. 3
      nova/tests/functional/notification_sample_tests/test_service.py
  22. 11
      nova/tests/functional/notification_sample_tests/test_volume.py
  23. 4
      nova/tests/functional/regressions/test_bug_1713783.py
  24. 9
      nova/tests/functional/regressions/test_bug_1735407.py
  25. 3
      nova/tests/functional/regressions/test_bug_1764883.py
  26. 13
      nova/tests/functional/regressions/test_bug_1781286.py
  27. 3
      nova/tests/functional/regressions/test_bug_1806515.py
  28. 5
      nova/tests/functional/regressions/test_bug_1835822.py
  29. 3
      nova/tests/functional/regressions/test_bug_1843090.py
  30. 3
      nova/tests/functional/regressions/test_bug_1843708.py
  31. 7
      nova/tests/functional/regressions/test_bug_1862633.py
  32. 3
      nova/tests/functional/test_cold_migrate.py
  33. 37
      nova/tests/functional/test_cross_cell_migrate.py
  34. 9
      nova/tests/functional/test_server_external_events.py
  35. 40
      nova/tests/functional/test_servers.py
  36. 3
      nova/tests/unit/compute/test_compute.py
  37. 35
      nova/tests/unit/compute/test_compute_mgr.py
  38. 55
      nova/tests/unit/compute/test_compute_utils.py
  39. 3
      nova/tests/unit/compute/test_host_api.py
  40. 4
      nova/tests/unit/compute/test_resource_tracker.py
  41. 3
      nova/tests/unit/conductor/test_conductor.py
  42. 4
      nova/tests/unit/objects/test_objects.py
  43. 15
      nova/tests/unit/test_exception_wrapper.py
  44. 58
      nova/tests/unit/test_notifications.py

1
nova/tests/fixtures/__init__.py

@ -20,6 +20,7 @@ from .glance import GlanceFixture # noqa: F401
from .libvirt import LibvirtFixture # noqa: F401
from .libvirt_imagebackend import LibvirtImageBackendFixture # noqa: F401
from .neutron import NeutronFixture # noqa: F401
from .notifications import NotificationFixture # noqa: F401
from .nova import * # noqa: F401, F403
from .os_brick import OSBrickFixture # noqa: F401
from .policy import OverridePolicyFixture # noqa: F401

39
nova/tests/fixtures/notifications.py

@ -0,0 +1,39 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import fixtures
from nova.tests.unit import fake_notifier
class NotificationFixture(fixtures.Fixture):
def __init__(self, test):
self.test = test
def setUp(self):
super().setUp()
self.addCleanup(fake_notifier.reset)
fake_notifier.stub_notifier(self.test)
def reset(self):
fake_notifier.reset()
def wait_for_versioned_notifications(
self, event_type, n_events=1, timeout=10.0,
):
return fake_notifier.VERSIONED_SUBS[event_type].wait_n(
n_events, event_type, timeout,
)
@property
def versioned_notifications(self):
return fake_notifier.VERSIONED_NOTIFICATIONS

12
nova/tests/functional/compute/test_cache_image.py

@ -15,7 +15,7 @@ from oslo_utils.fixture import uuidsentinel as uuids
from nova import context
from nova import objects
from nova import test
from nova.tests.unit import fake_notifier
from nova.tests import fixtures
class ImageCacheTest(test.TestCase):
@ -26,8 +26,8 @@ class ImageCacheTest(test.TestCase):
self.flags(compute_driver='fake.FakeDriverWithCaching')
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
self.notifier = self.useFixture(fixtures.NotificationFixture(self))
self.context = context.get_admin_context()
self.conductor = self.start_service('conductor')
@ -70,10 +70,10 @@ class ImageCacheTest(test.TestCase):
mgr = getattr(self, host)
self.assertEqual(set(), mgr.driver.cached_images)
fake_notifier.wait_for_versioned_notifications(
self.notifier.wait_for_versioned_notifications(
'aggregate.cache_images.start')
progress = fake_notifier.wait_for_versioned_notifications(
progress = self.notifier.wait_for_versioned_notifications(
'aggregate.cache_images.progress', n_events=4)
self.assertEqual(4, len(progress), progress)
for notification in progress:
@ -89,7 +89,7 @@ class ImageCacheTest(test.TestCase):
self.assertEqual(4, payload['total'])
self.assertIn('conductor', notification['publisher_id'])
fake_notifier.wait_for_versioned_notifications(
self.notifier.wait_for_versioned_notifications(
'aggregate.cache_images.end')
logtext = self.stdlog.logger.output

3
nova/tests/functional/compute/test_init_host.py

@ -16,7 +16,6 @@ import time
from nova import context as nova_context
from nova import objects
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_notifier
class ComputeManagerInitHostTestCase(
@ -164,7 +163,7 @@ class TestComputeRestartInstanceStuckInBuild(
# the instance.create.start is the closest thing to the
# instance_claim call we can wait for in the test
fake_notifier.wait_for_versioned_notifications(
self.notifier.wait_for_versioned_notifications(
'instance.create.start')
with mock.patch('nova.compute.manager.LOG.debug') as mock_log:

3
nova/tests/functional/compute/test_live_migration.py

@ -19,7 +19,6 @@ from nova import exception
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_notifier
class FakeCinderError(object):
@ -48,8 +47,6 @@ class LiveMigrationCinderFailure(integrated_helpers._IntegratedTestBase):
def setUp(self):
super(LiveMigrationCinderFailure, self).setUp()
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
# Start a second compute node (the first one was started for us by
# _IntegratedTestBase. set_nodes() is needed to avoid duplicate
# nodenames. See comments in test_bug_1702454.py.

3
nova/tests/functional/compute/test_resource_tracker.py

@ -32,7 +32,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_notifier
from nova.virt import driver as virt_driver
@ -703,8 +702,6 @@ class TestProviderConfig(integrated_helpers.ProviderUsageBaseTestCase):
self.api = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1')).admin_api
self.api.microversion = 'latest'
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
self.start_service('conductor')
# start nova-compute that will not have the additional trait.
self._start_compute("fake-host-1")

27
nova/tests/functional/integrated_helpers.py

@ -40,7 +40,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional.api import client as api_client
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.unit import fake_notifier
from nova import utils
@ -408,7 +407,7 @@ class InstanceHelperMixin:
self.api.post_server_action(
server['id'], {'reboot': {'type': 'HARD' if hard else 'SOFT'}},
)
fake_notifier.wait_for_versioned_notifications('instance.reboot.end')
self.notifier.wait_for_versioned_notifications('instance.reboot.end')
return self._wait_for_state_change(server, expected_state)
def _attach_interface(self, server, port_uuid):
@ -419,14 +418,14 @@ class InstanceHelperMixin:
}
}
attachment = self.api.attach_interface(server['id'], body)
fake_notifier.wait_for_versioned_notifications(
self.notifier.wait_for_versioned_notifications(
'instance.interface_attach.end')
return attachment
def _detach_interface(self, server, port_uuid):
"""detach a neutron port form a server."""
self.api.detach_interface(server['id'], port_uuid)
fake_notifier.wait_for_versioned_notifications(
self.notifier.wait_for_versioned_notifications(
'instance.interface_detach.end')
def _rebuild_server(self, server, image_uuid, expected_state='ACTIVE'):
@ -434,7 +433,7 @@ class InstanceHelperMixin:
self.api.post_server_action(
server['id'], {'rebuild': {'imageRef': image_uuid}},
)
fake_notifier.wait_for_versioned_notifications('instance.rebuild.end')
self.notifier.wait_for_versioned_notifications('instance.rebuild.end')
return self._wait_for_state_change(server, expected_state)
def _migrate_server(self, server, host=None):
@ -446,7 +445,7 @@ class InstanceHelperMixin:
def _resize_server(self, server, flavor_id):
self.api.post_server_action(
server['id'], {'resize': {'flavorRef': flavor_id}})
fake_notifier.wait_for_versioned_notifications('instance.resize.end')
self.notifier.wait_for_versioned_notifications('instance.resize.end')
return self._wait_for_state_change(server, 'VERIFY_RESIZE')
def _confirm_resize(self, server, *, cross_cell=False):
@ -469,7 +468,7 @@ class InstanceHelperMixin:
# dest host revert_resize method but the allocations are cleaned up
# in the source host finish_revert_resize method so we need to wait
# for the finish_revert_resize method to complete.
fake_notifier.wait_for_versioned_notifications(
self.notifier.wait_for_versioned_notifications(
'instance.resize_revert.end')
return server
@ -488,13 +487,13 @@ class InstanceHelperMixin:
def _suspend_server(self, server, expected_state='SUSPENDED'):
"""Suspend a server."""
self.api.post_server_action(server['id'], {'suspend': {}})
fake_notifier.wait_for_versioned_notifications('instance.suspend.end')
self.notifier.wait_for_versioned_notifications('instance.suspend.end')
return self._wait_for_state_change(server, expected_state)
def _resume_server(self, server, expected_state='ACTIVE'):
"""Resume a server."""
self.api.post_server_action(server['id'], {'resume': {}})
fake_notifier.wait_for_versioned_notifications('instance.resume.end')
self.notifier.wait_for_versioned_notifications('instance.resume.end')
return self._wait_for_state_change(server, expected_state)
def _shelve_server(self, server, expected_state='SHELVED_OFFLOADED'):
@ -914,7 +913,7 @@ class PlacementInstanceHelperMixin(InstanceHelperMixin, PlacementHelperMixin):
# instance.delete.end notification as that is emitted after the
# resources are freed.
fake_notifier.wait_for_versioned_notifications('instance.delete.end')
self.notifier.wait_for_versioned_notifications('instance.delete.end')
for rp_uuid in [
self._get_provider_uuid_by_host(hostname)
@ -1115,8 +1114,8 @@ class _IntegratedTestBase(test.TestCase, PlacementInstanceHelperMixin):
self.glance = self.useFixture(nova_fixtures.GlanceFixture(self))
self.policy = self.useFixture(nova_fixtures.RealPolicyFixture())
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
self.notifier = self.useFixture(
nova_fixtures.NotificationFixture(self))
self._setup_services()
@ -1186,8 +1185,8 @@ class ProviderUsageBaseTestCase(test.TestCase, PlacementInstanceHelperMixin):
self.placement = self.useFixture(func_fixtures.PlacementFixture()).api
self.useFixture(nova_fixtures.AllServicesCurrent())
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
self.notifier = self.useFixture(
nova_fixtures.NotificationFixture(self))
self.api_fixture = self.useFixture(nova_fixtures.OSAPIFixture(
api_version='v2.1'))

7
nova/tests/functional/libvirt/test_evacuate.py

@ -31,7 +31,6 @@ from nova.tests.fixtures import libvirt as fakelibvirt
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_network
from nova.tests.unit import fake_notifier
from nova.virt.libvirt import config as libvirt_config
CONF = conf.CONF
@ -431,8 +430,8 @@ class _LibvirtEvacuateTest(integrated_helpers.InstanceHelperMixin):
# force_down and evacuate without onSharedStorage
self.api.microversion = '2.14'
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
self.notifier = self.useFixture(
nova_fixtures.NotificationFixture(self))
self.useFixture(nova_fixtures.LibvirtFixture())
@ -523,7 +522,7 @@ class _LibvirtEvacuateTest(integrated_helpers.InstanceHelperMixin):
expected_task_state=None, expected_migration_status='failed')
# Wait for the rebuild to start, then complete
fake_notifier.wait_for_versioned_notifications(
self.notifier.wait_for_versioned_notifications(
'instance.rebuild.start')
# Meta-test

4
nova/tests/functional/libvirt/test_numa_servers.py

@ -27,7 +27,6 @@ from nova.tests import fixtures as nova_fixtures
from nova.tests.fixtures import libvirt as fakelibvirt
from nova.tests.functional.api import client
from nova.tests.functional.libvirt import base
from nova.tests.unit import fake_notifier
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
@ -1252,9 +1251,6 @@ class NUMAServersRebuildTests(NUMAServersTestBase):
self.image_ref_0 = images[0]['id']
self.image_ref_1 = images[1]['id']
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
def _create_active_server(self, server_args=None):
basic_server = {
'flavorRef': 1,

5
nova/tests/functional/libvirt/test_pci_sriov_servers.py

@ -35,7 +35,6 @@ from nova.tests import fixtures as nova_fixtures
from nova.tests.fixtures import libvirt as fakelibvirt
from nova.tests.functional.api import client
from nova.tests.functional.libvirt import base
from nova.tests.unit import fake_notifier
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
@ -711,14 +710,14 @@ class SRIOVAttachDetachTest(_PCIServersTestBase):
def _detach_port(self, instance_uuid, port_id):
self.api.detach_interface(instance_uuid, port_id)
fake_notifier.wait_for_versioned_notifications(
self.notifier.wait_for_versioned_notifications(
'instance.interface_detach.end')
def _attach_port(self, instance_uuid, port_id):
self.api.attach_interface(
instance_uuid,
{'interfaceAttachment': {'port_id': port_id}})
fake_notifier.wait_for_versioned_notifications(
self.notifier.wait_for_versioned_notifications(
'instance.interface_attach.end')
def _test_detach_attach(self, first_port_id, second_port_id):

29
nova/tests/functional/notification_sample_tests/notification_sample_base.py

@ -27,7 +27,6 @@ from nova.tests.functional import integrated_helpers
from nova.tests import json_ref
from nova.tests.unit.api.openstack.compute import test_services
from nova.tests.unit import fake_crypto
from nova.tests.unit import fake_notifier
CONF = cfg.CONF
@ -75,8 +74,8 @@ class NotificationSampleTestBase(test.TestCase,
self.api.microversion = max_version
self.admin_api.microversion = max_version
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
self.notifier = self.useFixture(
nova_fixtures.NotificationFixture(self))
self.useFixture(utils_fixture.TimeFixture(test_services.fake_utcnow()))
self.useFixture(nova_fixtures.GlanceFixture(self))
@ -92,7 +91,7 @@ class NotificationSampleTestBase(test.TestCase,
self.start_service('scheduler')
self.compute = self.start_service('compute')
# Reset the service create notifications
fake_notifier.reset()
self.notifier.reset()
def _get_notification_sample(self, sample):
sample_dir = os.path.dirname(os.path.abspath(__file__))
@ -136,9 +135,9 @@ class NotificationSampleTestBase(test.TestCase,
notification emitted during the test.
"""
if not actual:
self.assertEqual(1, len(fake_notifier.VERSIONED_NOTIFICATIONS),
fake_notifier.VERSIONED_NOTIFICATIONS)
notification = fake_notifier.VERSIONED_NOTIFICATIONS[0]
self.assertEqual(1, len(self.notifier.versioned_notifications),
self.notifier.versioned_notifications)
notification = self.notifier.versioned_notifications[0]
else:
notification = actual
sample_file = self._get_notification_sample(sample_file_name)
@ -163,12 +162,12 @@ class NotificationSampleTestBase(test.TestCase,
scheduler_expected_notifications = [
'scheduler-select_destinations-start',
'scheduler-select_destinations-end']
self.assertLessEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertLessEqual(2, len(self.notifier.versioned_notifications))
for notification in scheduler_expected_notifications:
self._verify_notification(
notification,
replacements=replacements,
actual=fake_notifier.VERSIONED_NOTIFICATIONS.pop(0))
actual=self.notifier.versioned_notifications.pop(0))
def _boot_a_server(self, expected_status='ACTIVE', extra_params=None,
scheduler_hints=None, additional_extra_specs=None):
@ -191,7 +190,7 @@ class NotificationSampleTestBase(test.TestCase,
self.admin_api.post_extra_spec(flavor_id, extra_specs)
# Ignore the create flavor notification
fake_notifier.reset()
self.notifier.reset()
keypair_req = {
"keypair": {
@ -204,11 +203,11 @@ class NotificationSampleTestBase(test.TestCase,
'keypair-import-start',
'keypair-import-end'
]
self.assertLessEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertLessEqual(2, len(self.notifier.versioned_notifications))
for notification in keypair_expected_notifications:
self._verify_notification(
notification,
actual=fake_notifier.VERSIONED_NOTIFICATIONS.pop(0))
actual=self.notifier.versioned_notifications.pop(0))
server = self._build_server(
name='some-server',
@ -252,19 +251,19 @@ class NotificationSampleTestBase(test.TestCase,
def _get_notifications(self, event_type):
return [notification for notification
in fake_notifier.VERSIONED_NOTIFICATIONS
in self.notifier.versioned_notifications
if notification['event_type'] == event_type]
def _wait_for_notification(self, event_type, timeout=10.0):
# NOTE(mdbooth): wait_for_versioned_notifications raises an exception
# if it times out since change I017d1a31. Consider removing this
# method.
fake_notifier.wait_for_versioned_notifications(
self.notifier.wait_for_versioned_notifications(
event_type, timeout=timeout)
def _wait_for_notifications(self, event_type, expected_count,
timeout=10.0):
notifications = fake_notifier.wait_for_versioned_notifications(
notifications = self.notifier.wait_for_versioned_notifications(
event_type, n_events=expected_count, timeout=timeout)
msg = ''.join('\n%s' % notif for notif in notifications)

55
nova/tests/functional/notification_sample_tests/test_aggregate.py

@ -11,7 +11,6 @@
# under the License.
from nova.tests.functional.notification_sample_tests \
import notification_sample_base
from nova.tests.unit import fake_notifier
class TestAggregateNotificationSample(
@ -28,34 +27,34 @@ class TestAggregateNotificationSample(
"availability_zone": "nova"}}
aggregate = self.admin_api.post_aggregate(aggregate_req)
self.assertEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(2, len(self.notifier.versioned_notifications))
self._verify_notification(
'aggregate-create-start',
replacements={
'uuid': aggregate['uuid']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
actual=self.notifier.versioned_notifications[0])
self._verify_notification(
'aggregate-create-end',
replacements={
'uuid': aggregate['uuid'],
'id': aggregate['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
actual=self.notifier.versioned_notifications[1])
self.admin_api.delete_aggregate(aggregate['id'])
self.assertEqual(4, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(4, len(self.notifier.versioned_notifications))
self._verify_notification(
'aggregate-delete-start',
replacements={
'uuid': aggregate['uuid'],
'id': aggregate['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[2])
actual=self.notifier.versioned_notifications[2])
self._verify_notification(
'aggregate-delete-end',
replacements={
'uuid': aggregate['uuid'],
'id': aggregate['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[3])
actual=self.notifier.versioned_notifications[3])
def test_aggregate_add_remove_host(self):
aggregate_req = {
@ -64,7 +63,7 @@ class TestAggregateNotificationSample(
"availability_zone": "nova"}}
aggregate = self.admin_api.post_aggregate(aggregate_req)
fake_notifier.reset()
self.notifier.reset()
add_host_req = {
"add_host": {
@ -73,19 +72,19 @@ class TestAggregateNotificationSample(
}
self.admin_api.post_aggregate_action(aggregate['id'], add_host_req)
self.assertEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(2, len(self.notifier.versioned_notifications))
self._verify_notification(
'aggregate-add_host-start',
replacements={
'uuid': aggregate['uuid'],
'id': aggregate['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
actual=self.notifier.versioned_notifications[0])
self._verify_notification(
'aggregate-add_host-end',
replacements={
'uuid': aggregate['uuid'],
'id': aggregate['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
actual=self.notifier.versioned_notifications[1])
remove_host_req = {
"remove_host": {
@ -94,19 +93,19 @@ class TestAggregateNotificationSample(
}
self.admin_api.post_aggregate_action(aggregate['id'], remove_host_req)
self.assertEqual(4, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(4, len(self.notifier.versioned_notifications))
self._verify_notification(
'aggregate-remove_host-start',
replacements={
'uuid': aggregate['uuid'],
'id': aggregate['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[2])
actual=self.notifier.versioned_notifications[2])
self._verify_notification(
'aggregate-remove_host-end',
replacements={
'uuid': aggregate['uuid'],
'id': aggregate['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[3])
actual=self.notifier.versioned_notifications[3])
self.admin_api.delete_aggregate(aggregate['id'])
@ -124,22 +123,22 @@ class TestAggregateNotificationSample(
}
}
}
fake_notifier.reset()
self.notifier.reset()
self.admin_api.post_aggregate_action(aggregate['id'], set_metadata_req)
self.assertEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(2, len(self.notifier.versioned_notifications))
self._verify_notification(
'aggregate-update_metadata-start',
replacements={
'uuid': aggregate['uuid'],
'id': aggregate['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
actual=self.notifier.versioned_notifications[0])
self._verify_notification(
'aggregate-update_metadata-end',
replacements={
'uuid': aggregate['uuid'],
'id': aggregate['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
actual=self.notifier.versioned_notifications[1])
def test_aggregate_updateprops(self):
aggregate_req = {
@ -157,19 +156,19 @@ class TestAggregateNotificationSample(
# 1. aggregate-create-end
# 2. aggregate-update_prop-start
# 3. aggregate-update_prop-end
self.assertEqual(4, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(4, len(self.notifier.versioned_notifications))
self._verify_notification(
'aggregate-update_prop-start',
replacements={
'uuid': aggregate['uuid'],
'id': aggregate['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[2])
actual=self.notifier.versioned_notifications[2])
self._verify_notification(
'aggregate-update_prop-end',
replacements={
'uuid': aggregate['uuid'],
'id': aggregate['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[3])
actual=self.notifier.versioned_notifications[3])
def test_aggregate_cache_images(self):
aggregate_req = {
@ -184,7 +183,7 @@ class TestAggregateNotificationSample(
}
self.admin_api.post_aggregate_action(aggregate['id'], add_host_req)
fake_notifier.reset()
self.notifier.reset()
cache_images_req = {
'cache': [
@ -195,26 +194,26 @@ class TestAggregateNotificationSample(
cache_images_req)
# Since the operation is asynchronous we have to wait for the end
# notification.
fake_notifier.wait_for_versioned_notifications(
self.notifier.wait_for_versioned_notifications(
'aggregate.cache_images.end')
self.assertEqual(3, len(fake_notifier.VERSIONED_NOTIFICATIONS),
fake_notifier.VERSIONED_NOTIFICATIONS)
self.assertEqual(3, len(self.notifier.versioned_notifications),
self.notifier.versioned_notifications)
self._verify_notification(
'aggregate-cache_images-start',
replacements={
'uuid': aggregate['uuid'],
'id': aggregate['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
actual=self.notifier.versioned_notifications[0])
self._verify_notification(
'aggregate-cache_images-progress',
replacements={
'uuid': aggregate['uuid'],
'id': aggregate['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
actual=self.notifier.versioned_notifications[1])
self._verify_notification(
'aggregate-cache_images-end',
replacements={
'uuid': aggregate['uuid'],
'id': aggregate['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[2])
actual=self.notifier.versioned_notifications[2])

23
nova/tests/functional/notification_sample_tests/test_compute_task.py

@ -13,7 +13,6 @@
from nova.tests import fixtures
from nova.tests.functional.notification_sample_tests \
import notification_sample_base
from nova.tests.unit import fake_notifier
class TestComputeTaskNotificationSample(
@ -38,8 +37,8 @@ class TestComputeTaskNotificationSample(
self._wait_for_notification('compute_task.build_instances.error')
# 0. scheduler.select_destinations.start
# 1. compute_task.rebuild_server.error
self.assertEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS),
fake_notifier.VERSIONED_NOTIFICATIONS)
self.assertEqual(2, len(self.notifier.versioned_notifications),
self.notifier.versioned_notifications)
self._verify_notification(
'compute_task-build_instances-error',
replacements={
@ -52,7 +51,7 @@ class TestComputeTaskNotificationSample(
'reason.module_name': self.ANY,
'reason.traceback': self.ANY
},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
actual=self.notifier.versioned_notifications[1])
def test_rebuild_fault(self):
server = self._boot_a_server(
@ -65,7 +64,7 @@ class TestComputeTaskNotificationSample(
service_id = self.api.get_service_id('nova-compute')
self.admin_api.put_service_force_down(service_id, True)
fake_notifier.reset()
self.notifier.reset()
# NOTE(takashin): The rebuild action and the evacuate action shares
# same code path. So the 'evacuate' action is used for this test.
@ -76,8 +75,8 @@ class TestComputeTaskNotificationSample(
# 0. instance.evacuate
# 1. scheduler.select_destinations.start
# 2. compute_task.rebuild_server.error
self.assertEqual(3, len(fake_notifier.VERSIONED_NOTIFICATIONS),
fake_notifier.VERSIONED_NOTIFICATIONS)
self.assertEqual(3, len(self.notifier.versioned_notifications),
self.notifier.versioned_notifications)
self._verify_notification(
'compute_task-rebuild_server-error',
replacements={
@ -90,7 +89,7 @@ class TestComputeTaskNotificationSample(
'reason.module_name': self.ANY,
'reason.traceback': self.ANY
},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[2])
actual=self.notifier.versioned_notifications[2])
def test_migrate_fault(self):
server = self._boot_a_server(
@ -103,14 +102,14 @@ class TestComputeTaskNotificationSample(
service_id = self.api.get_service_id('nova-compute')
self.admin_api.put_service(service_id, {'status': 'disabled'})
fake_notifier.reset()
self.notifier.reset()
# Note that the operation will return a 202 response but fail with
# NoValidHost asynchronously.
self.admin_api.post_server_action(server['id'], {'migrate': None})
self._wait_for_notification('compute_task.migrate_server.error')
self.assertEqual(1, len(fake_notifier.VERSIONED_NOTIFICATIONS),
fake_notifier.VERSIONED_NOTIFICATIONS)
self.assertEqual(1, len(self.notifier.versioned_notifications),
self.notifier.versioned_notifications)
self._verify_notification(
'compute_task-migrate_server-error',
replacements={
@ -124,4 +123,4 @@ class TestComputeTaskNotificationSample(
'reason.module_name': self.ANY,
'reason.traceback': self.ANY
},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
actual=self.notifier.versioned_notifications[0])

7
nova/tests/functional/notification_sample_tests/test_exception_notification.py

@ -12,7 +12,6 @@
from nova.tests.functional.api import client as api_client
from nova.tests.functional.notification_sample_tests \
import notification_sample_base
from nova.tests.unit import fake_notifier
class TestExceptionNotificationSample(
@ -33,12 +32,12 @@ class TestExceptionNotificationSample(
self.assertRaises(api_client.OpenStackApiException,
self.admin_api.api_post, 'os-aggregates', post)
self.assertEqual(4, len(fake_notifier.VERSIONED_NOTIFICATIONS))
traceback = fake_notifier.VERSIONED_NOTIFICATIONS[3][
self.assertEqual(4, len(self.notifier.versioned_notifications))
traceback = self.notifier.versioned_notifications[3][
'payload']['nova_object.data']['traceback']
self.assertIn('AggregateNameExists', traceback)
self._verify_notification(
'compute-exception',
replacements={
'traceback': self.ANY},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[3])
actual=self.notifier.versioned_notifications[3])

13
nova/tests/functional/notification_sample_tests/test_flavor.py

@ -12,7 +12,6 @@
from nova.tests.functional.notification_sample_tests \
import notification_sample_base
from nova.tests.unit import fake_notifier
class TestFlavorNotificationSample(
@ -48,7 +47,7 @@ class TestFlavorNotificationSample(
self.admin_api.api_delete(
'flavors/a22d5517-147c-4147-a0d1-e698df5cd4e3')
self._verify_notification(
'flavor-delete', actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
'flavor-delete', actual=self.notifier.versioned_notifications[1])
def test_flavor_update(self):
body = {
@ -84,7 +83,7 @@ class TestFlavorNotificationSample(
body)
self._verify_notification(
'flavor-update', actual=fake_notifier.VERSIONED_NOTIFICATIONS[2])
'flavor-update', actual=self.notifier.versioned_notifications[2])
class TestFlavorNotificationSamplev2_55(
@ -110,11 +109,11 @@ class TestFlavorNotificationSamplev2_55(
flavor = self.admin_api.api_post('flavors', body).body['flavor']
# Check the notification; should be the same as the sample where there
# is no description set.
self.assertEqual(1, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(1, len(self.notifier.versioned_notifications))
self._verify_notification(
'flavor-create',
replacements={'is_public': False},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
actual=self.notifier.versioned_notifications[0])
# Update and set the flavor description.
self.admin_api.api_put(
@ -122,10 +121,10 @@ class TestFlavorNotificationSamplev2_55(
{'flavor': {'description': 'test description'}}).body['flavor']
# Assert the notifications, one for create and one for update.
self.assertEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(2, len(self.notifier.versioned_notifications))
self._verify_notification(
'flavor-update',
replacements={'description': 'test description',
'extra_specs': {},
'projects': []},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
actual=self.notifier.versioned_notifications[1])

417
nova/tests/functional/notification_sample_tests/test_instance.py

File diff suppressed because it is too large

19
nova/tests/functional/notification_sample_tests/test_keypair.py

@ -11,7 +11,6 @@
# under the License.
from nova.tests.functional.notification_sample_tests \
import notification_sample_base
from nova.tests.unit import fake_notifier
class TestKeypairNotificationSample(
@ -26,35 +25,35 @@ class TestKeypairNotificationSample(
}}
keypair = self.api.post_keypair(keypair_req)
self.assertEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(2, len(self.notifier.versioned_notifications))
self._verify_notification(
'keypair-create-start',
replacements={},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
actual=self.notifier.versioned_notifications[0])
self._verify_notification(
'keypair-create-end',
replacements={
"fingerprint": keypair['fingerprint'],
"public_key": keypair['public_key']
},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
actual=self.notifier.versioned_notifications[1])
self.api.delete_keypair(keypair['name'])
self.assertEqual(4, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(4, len(self.notifier.versioned_notifications))
self._verify_notification(
'keypair-delete-start',
replacements={
"fingerprint": keypair['fingerprint'],
"public_key": keypair['public_key']
},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[2])
actual=self.notifier.versioned_notifications[2])
self._verify_notification(
'keypair-delete-end',
replacements={
"fingerprint": keypair['fingerprint'],
"public_key": keypair['public_key']
},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[3])
actual=self.notifier.versioned_notifications[3])
def test_keypair_import(self):
pub_key = ('ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDx8nkQv/zgGg'
@ -71,10 +70,10 @@ class TestKeypairNotificationSample(
self.api.post_keypair(keypair_req)
self.assertEqual(2, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(2, len(self.notifier.versioned_notifications))
self._verify_notification(
'keypair-import-start',
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
actual=self.notifier.versioned_notifications[0])
self._verify_notification(
'keypair-import-end',
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
actual=self.notifier.versioned_notifications[1])

5
nova/tests/functional/notification_sample_tests/test_libvirt.py

@ -21,7 +21,6 @@ from nova.tests import fixtures as nova_fixtures
from nova.tests.fixtures import libvirt as fakelibvirt
from nova.tests.functional.notification_sample_tests \
import notification_sample_base
from nova.tests.unit import fake_notifier
from nova.virt.libvirt import host
@ -45,7 +44,7 @@ class TestLibvirtErrorNotificationSample(
self.assertRaises(exception.HypervisorUnavailable,
self.restart_compute_service, self.compute)
self.assertEqual(1, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(1, len(self.notifier.versioned_notifications))
self._verify_notification(
'libvirt-connect-error',
replacements={
@ -54,4 +53,4 @@ class TestLibvirtErrorNotificationSample(
'reason.module_name': self.ANY,
'reason.traceback': self.ANY
},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
actual=self.notifier.versioned_notifications[0])

5
nova/tests/functional/notification_sample_tests/test_metrics.py

@ -16,7 +16,6 @@ import nova.conf
from nova import context
from nova.tests.functional.notification_sample_tests \
import notification_sample_base
from nova.tests.unit import fake_notifier
CONF = nova.conf.CONF
@ -35,8 +34,8 @@ class TestMetricsNotificationSample(
self.compute.manager.update_available_resource(
context.get_admin_context())
self.assertEqual(1, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(1, len(self.notifier.versioned_notifications))
self._verify_notification(
'metrics-update',
replacements={'host_ip': CONF.my_ip},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
actual=self.notifier.versioned_notifications[0])

17
nova/tests/functional/notification_sample_tests/test_server_group.py

@ -12,7 +12,6 @@
from nova.tests import fixtures
from nova.tests.functional.notification_sample_tests \
import notification_sample_base
from nova.tests.unit import fake_notifier
class TestServerGroupNotificationSample(
@ -31,20 +30,20 @@ class TestServerGroupNotificationSample(
}
group = self.api.post_server_groups(group_req)
self.assertEqual(1, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(1, len(self.notifier.versioned_notifications))
self._verify_notification(
'server_group-create',
replacements={'uuid': group['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
actual=self.notifier.versioned_notifications[0])
fake_notifier.reset()
self.notifier.reset()
self.api.delete_server_group(group['id'])
self.assertEqual(1, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(1, len(self.notifier.versioned_notifications))
self._verify_notification(
'server_group-delete',
replacements={'uuid': group['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
actual=self.notifier.versioned_notifications[0])
def test_server_group_add_member(self):
group_req = {
@ -53,7 +52,7 @@ class TestServerGroupNotificationSample(
"rules": {"max_server_per_host": 3}
}
group = self.api.post_server_groups(group_req)
fake_notifier.reset()
self.notifier.reset()
server = self._boot_a_server(
extra_params={'networks': [{'port': self.neutron.port_1['id']}]},
@ -66,9 +65,9 @@ class TestServerGroupNotificationSample(
# 4: instance.create.end
# 5: instance.update
# (Due to adding server tags in the '_boot_a_server' method.)
self.assertEqual(6, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(6, len(self.notifier.versioned_notifications))
self._verify_notification(
'server_group-add_member',
replacements={'uuid': group['id'],
'members': [server['id']]},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
actual=self.notifier.versioned_notifications[0])

3
nova/tests/functional/notification_sample_tests/test_service.py

@ -20,7 +20,6 @@ from nova.tests import fixtures
from nova.tests.functional.notification_sample_tests \
import notification_sample_base
from nova.tests.unit.api.openstack.compute import test_services
from nova.tests.unit import fake_notifier
class TestServiceNotificationBase(
@ -167,4 +166,4 @@ class TestServiceNotificationSample(TestServiceNotificationBase):
self._verify_notification(
'service-delete',
replacements={'uuid': compute2_service_id},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
actual=self.notifier.versioned_notifications[1])

11
nova/tests/functional/notification_sample_tests/test_volume.py

@ -16,7 +16,6 @@ from nova import context
from nova.tests import fixtures
from nova.tests.functional.notification_sample_tests \
import notification_sample_base
from nova.tests.unit import fake_notifier
class TestVolumeUsageNotificationSample(
@ -34,7 +33,7 @@ class TestVolumeUsageNotificationSample(
server = self._boot_a_server(
extra_params={'networks': [{'port': self.neutron.port_1['id']}]})
self._attach_volume_to_server(server, self.cinder.SWAP_OLD_VOL)
fake_notifier.reset()
self.notifier.reset()
return server
@ -47,19 +46,19 @@ class TestVolumeUsageNotificationSample(
# 0. volume_detach-start
# 1. volume.usage
# 2. volume_detach-end
self.assertEqual(3, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(3, len(self.notifier.versioned_notifications))
self._verify_notification(
'volume-usage',
replacements={'instance_uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[1])
actual=self.notifier.versioned_notifications[1])
def test_instance_poll_volume_usage(self):
server = self._setup_server_with_volume_attached()
self.compute.manager._poll_volume_usage(context.get_admin_context())
self.assertEqual(1, len(fake_notifier.VERSIONED_NOTIFICATIONS))
self.assertEqual(1, len(self.notifier.versioned_notifications))
self._verify_notification(
'volume-usage',
replacements={'instance_uuid': server['id']},
actual=fake_notifier.VERSIONED_NOTIFICATIONS[0])
actual=self.notifier.versioned_notifications[0])

4
nova/tests/functional/regressions/test_bug_1713783.py

@ -91,8 +91,8 @@ class FailedEvacuateStateTests(test.TestCase,
host=self.hostname, binary='nova-compute')[0]['id']
self.api.put_service(compute_id, {'forced_down': 'true'})
fake_notifier.stub_notifier(self)
fake_notifier.reset()
self.notifier = self.useFixture(
nova_fixtures.NotificationFixture(self))
# Initiate evacuation
self._evacuate_server(

9
nova/tests/functional/regressions/test_bug_1735407.py

@ -16,7 +16,6 @@ from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_network
from nova.tests.unit import fake_notifier
class TestParallelEvacuationWithServerGroup(
@ -47,8 +46,8 @@ class TestParallelEvacuationWithServerGroup(
# 2.14 is needed for evacuate without onSharedStorage flag
self.api.microversion = '2.14'
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
self.notifier = self.useFixture(
nova_fixtures.NotificationFixture(self))
# the image fake backend needed for image discovery
self.useFixture(nova_fixtures.GlanceFixture(self))
@ -77,7 +76,7 @@ class TestParallelEvacuationWithServerGroup(
# validation
if instance.host == 'host1':
# wait for the other instance rebuild to start
fake_notifier.wait_for_versioned_notifications(
self.notifier.wait_for_versioned_notifications(
'instance.rebuild.start', n_events=1)
original_rebuild(self_, context, instance, *args, **kwargs)
@ -127,7 +126,7 @@ class TestParallelEvacuationWithServerGroup(
# NOTE(mdbooth): We only get 1 rebuild.start notification here because
# we validate server group policy (and therefore fail) before emitting
# rebuild.start.
fake_notifier.wait_for_versioned_notifications(
self.notifier.wait_for_versioned_notifications(
'instance.rebuild.start', n_events=1)
server1 = self._wait_for_server_parameter(
server1, {'OS-EXT-STS:task_state': None})

3
nova/tests/functional/regressions/test_bug_1764883.py

@ -16,7 +16,6 @@ from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_network
from nova.tests.unit import fake_notifier
class TestEvacuationWithSourceReturningDuringRebuild(
@ -63,8 +62,6 @@ class TestEvacuationWithSourceReturningDuringRebuild(
self.image_id = self.api.get_images()[0]['id']
self.flavor_id = self.api.get_flavors()[0]['id']
self.addCleanup(fake_notifier.reset)
# Stub out rebuild with a slower method allowing the src compute to be
# restarted once the migration hits pre-migrating after claiming
# resources on the dest.

13
nova/tests/functional/regressions/test_bug_1781286.py

@ -20,7 +20,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_notifier
class RescheduleBuildAvailabilityZoneUpCall(
@ -51,8 +50,8 @@ class RescheduleBuildAvailabilityZoneUpCall(
self.start_service('compute', host='host1')
self.start_service('compute', host='host2')
# Listen for notifications.
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
self.notifier = self.useFixture(
nova_fixtures.NotificationFixture(self))
def test_server_create_reschedule_blocked_az_up_call(self):
self.flags(default_availability_zone='us-central')
@ -80,7 +79,7 @@ class RescheduleBuildAvailabilityZoneUpCall(
# Because we poisoned AggregateList.get_by_host after hitting the
# compute service we have to wait for the notification that the build
# is complete and then stop the mock so we can use the API again.
fake_notifier.wait_for_versioned_notifications('instance.create.end')
self.notifier.wait_for_versioned_notifications('instance.create.end')
# Note that we use stopall here because we actually called
# build_and_run_instance twice so we have more than one instance of
# the mock that needs to be stopped.
@ -116,8 +115,8 @@ class RescheduleMigrateAvailabilityZoneUpCall(
self.start_service('compute', host='host2')
self.start_service('compute', host='host3')
# Listen for notifications.
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
self.notifier = self.useFixture(
nova_fixtures.NotificationFixture(self))
def test_migrate_reschedule_blocked_az_up_call(self):
self.flags(default_availability_zone='us-central')
@ -153,7 +152,7 @@ class RescheduleMigrateAvailabilityZoneUpCall(
# Because we poisoned AggregateList.get_by_host after hitting the
# compute service we have to wait for the notification that the resize
# is complete and then stop the mock so we can use the API again.
fake_notifier.wait_for_versioned_notifications(
self.notifier.wait_for_versioned_notifications(
'instance.resize_finish.end')
# Note that we use stopall here because we actually called _prep_resize
# twice so we have more than one instance of the mock that needs to be

3
nova/tests/functional/regressions/test_bug_1806515.py

@ -13,7 +13,6 @@
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_notifier
class ShowErrorServerWithTags(test.TestCase,
@ -41,8 +40,6 @@ class ShowErrorServerWithTags(test.TestCase,
self.api.microversion = 'latest'
self.addCleanup(fake_notifier.reset)
def _create_error_server(self):
server = self.api.post_server({
'server': {

5
nova/tests/functional/regressions/test_bug_1835822.py

@ -14,7 +14,6 @@ from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_notifier
class RegressionTest1835822(
@ -39,8 +38,8 @@ class RegressionTest1835822(
self.image_ref_0 = images[0]['id']
self.image_ref_1 = images[1]['id']
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
self.notifier = self.useFixture(
nova_fixtures.NotificationFixture(self))
def _create_active_server(self, server_args=None):
basic_server = {

3
nova/tests/functional/regressions/test_bug_1843090.py

@ -15,7 +15,6 @@ import nova.compute
from nova import exception
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_notifier
class PinnedComputeRpcTests(integrated_helpers.ProviderUsageBaseTestCase):
@ -28,8 +27,6 @@ class PinnedComputeRpcTests(integrated_helpers.ProviderUsageBaseTestCase):
self.useFixture(nova_fixtures.HostNameWeigherFixture())
super(PinnedComputeRpcTests, self).setUp()
fake_notifier.stub_notifier(self)
self.addCleanup(fake_notifier.reset)
self.compute1 = self._start_compute(host='host1')
self.compute2 = self._start_compute(host='host2')

3
nova/tests/functional/regressions/test_bug_1843708.py

@ -15,7 +15,6 @@
from nova import context
from nova import objects
from nova.tests.functional import integrated_helpers
from nova.tests.unit import fake_notifier
class RebuildWithKeypairTestCase(integrated_helpers._IntegratedTestBase):
@ -59,7 +58,7 @@ class RebuildWithKeypairTestCase(integrated_helpers._IntegratedTestBase):
},
}
self.api.api_post('servers/%s/action' % server['id'], body)
fake_notifier.wait_for_versioned_notifications('instance.rebuild.end')
self.notifier.wait_for_versioned_notifications('instance.rebuild.end