summaryrefslogtreecommitdiff
path: root/nova/tests/unit/notifications
diff options
context:
space:
mode:
authorSean Mooney <work@seanmooney.info>2019-12-12 01:42:57 +0000
committerEric Fried <openstack@fried.cc>2019-12-13 10:08:07 -0600
commit7dce6153622019c4f7343c49064765e4dc846ac8 (patch)
treeabfdc8735a2ac2e5e8ebee2388a2d586a57ac328 /nova/tests/unit/notifications
parent8c7224172641c6194582ca4cf7ce11e907df50aa (diff)
downloadnova-7dce6153622019c4f7343c49064765e4dc846ac8.tar.gz
Sync ImageMetaPropsPayload fields
This change adds missing fields to the image metadata notification object and adds a unit tests to assert that the notification object and nova object stay in sync. This change also adds unit tests to assert the notification schema and fields are in sync and that the schema is valid. Change-Id: I36ea5d5e677ab3e6c88223b20f5377e9471c55db Closes-Bug: #1856100
Diffstat (limited to 'nova/tests/unit/notifications')
-rw-r--r--nova/tests/unit/notifications/objects/test_notification.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/nova/tests/unit/notifications/objects/test_notification.py b/nova/tests/unit/notifications/objects/test_notification.py
index 4dbcf23b49..f67806ddbb 100644
--- a/nova/tests/unit/notifications/objects/test_notification.py
+++ b/nova/tests/unit/notifications/objects/test_notification.py
@@ -20,6 +20,7 @@ from oslo_versionedobjects import fixture
from nova import exception
from nova.notifications.objects import base as notification
+from nova.notifications.objects.image import ImageMetaPropsPayload
from nova import objects
from nova.objects import base
from nova.objects import fields
@@ -383,7 +384,7 @@ notification_object_data = {
'FlavorNotification': '1.0-a73147b93b520ff0061865849d3dfa56',
'FlavorPayload': '1.4-2e7011b8b4e59167fe8b7a0a81f0d452',
'ImageMetaPayload': '1.0-0e65beeacb3393beed564a57bc2bc989',
- 'ImageMetaPropsPayload': '1.2-f237f65e1f14f05a73481dc4192df3ba',
+ 'ImageMetaPropsPayload': '1.3-9c200c895932163a4e14e6bb385fa1e0',
'InstanceActionNotification': '1.0-a73147b93b520ff0061865849d3dfa56',
'InstanceActionPayload': '1.8-4fa3da9cbf0761f1f700ae578f36dc2f',
'InstanceActionRebuildNotification':
@@ -479,6 +480,33 @@ class TestNotificationObjectVersions(test.NoDBTestCase):
self.assertNotEqual(old_hash, new_hash)
+class TestImageMetaPropsPayloadNotifications(test.NoDBTestCase):
+ def setUp(self):
+ super().setUp()
+ base.NovaObjectRegistry.register_notification_objects()
+
+ def test_object_field_sync(self):
+ """Assert the fields of the ImageMetaPropsPayload object are
+ in sync with the fields of the ImageMetaProps object.
+ """
+ self.assertEqual(
+ ImageMetaPropsPayload.fields.keys(),
+ objects.image_meta.ImageMetaProps.fields.keys())
+
+ def test_schema_field_sync(self):
+ """Assert the fields of the ImageMetaPropsPayload object are
+ in sync with schema definition.
+ """
+ self.assertEqual(
+ ImageMetaPropsPayload.fields.keys(),
+ ImageMetaPropsPayload.SCHEMA.keys())
+
+ def test_schema(self):
+ """Assert the schema is generated correctly"""
+ for key, value in ImageMetaPropsPayload.SCHEMA.items():
+ self.assertEqual(('image_meta_props', key), value)
+
+
def get_extra_data(obj_class):
extra_data = tuple()