Skip to content

Instantly share code, notes, and snippets.

@psachin
Created June 29, 2017 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psachin/85d10001168b1ee406d99d5793f7ec1f to your computer and use it in GitHub Desktop.
Save psachin/85d10001168b1ee406d99d5793f7ec1f to your computer and use it in GitHub Desktop.
aodh/tests/unit/test_event.py
diff --git a/aodh/tests/unit/test_event.py b/aodh/tests/unit/test_event.py
index 2a85b97..0a7d6bb 100644
--- a/aodh/tests/unit/test_event.py
+++ b/aodh/tests/unit/test_event.py
@@ -51,8 +51,32 @@ class TestEventAlarmEvaluationService(tests_base.BaseTestCase):
'traits': ['foo', 'bar'],
'message_id': '20d03d17-4aba-4900-a179-dba1281a3452',
'generated': '2016-04-23T06:50:23.622739'}
+ unicodeevent = {u'event_type': u'compute.instance.power_off.end',
+ u'traits': [[u'user_id', 1, u'89b4e48bcbdb4816add7800502bd5122'],
+ [u'service', 1, u'compute'],
+ [u'disk_gb', 2, 1],
+ [u'resource_id', 1, u'bb912729-fa51-443b-bac6-bf4c795f081d'],
+ [u'tenant_id', 1, u'9ee200732f4c4d10a6530bac746f1b6e'],
+ [u'root_gb', 2, 1],
+ [u'ephemeral_gb', 2, 0],
+ [u'instance_type_id', 2, 1],
+ [u'state', 1, u'stopped'],
+ [u'memory_mb', 2, 512],
+ [u'launched_at', 4, u'2017-06-20T00:57:41'],
+ [u'instance_id', 1, u'bb912729-fa51-443b-bac6-bf4c795f081d'],
+ [u'host', 1, u'testserver.com'],
+ [u'request_id', 1, u'req-8c40407e-e25c-4c46-9de4-59413fc1ffd4'],
+ [u'instance_type', 1, u'm1.tiny'],
+ [u'project_id', 1, u'9ee200732f4c4d10a6530bac746f1b6e'],
+ [u'vcpus', 2, 1]],
+ u'message_signature': u'c1f2abdac3df3350a36033ba54065474a2e95d599714a8790fd408d007b11a8d',
+ u'raw': {},
+ u'generated': u'2017-06-29T09:55:27.430221',
+ u'message_id': u'e0757072-175d-47dc-9999-fcd9ba96036c'}
+
msg_notifier.sample({}, 'event', event1)
msg_notifier.sample({}, 'event', event2)
+ msg_notifier.sample({}, 'event', unicodeevent)
svc = event.EventAlarmEvaluationService(0, self.CONF)
self.addCleanup(svc.terminate)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment