compute: fix notifications test

This test isn't run anymore because it yields things, and that seems to have
no sense. Let's fix it.

Change-Id: I97a4a956895f973b5ece30848a845db3fa6d67c0
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2013-02-11 17:25:01 +01:00
parent 3340461656
commit 00898e1d2f

View File

@ -22,6 +22,7 @@ notification events.
import unittest
from ceilometer.compute import notifications
from ceilometer import counter
INSTANCE_CREATE_END = {
@ -287,26 +288,24 @@ INSTANCE_RESIZE_REVERT_END = {
class TestNotifications(unittest.TestCase):
def test_process_notification(self):
info = notifications.Instance.process_notification(
info = notifications.Instance().process_notification(
INSTANCE_CREATE_END
)[0]
for name, actual, expected in [
('counter_name', info.name, 'instance'),
('counter_type', info.type, counter.TYPE_CUMULATIVE),
('counter_volume', info.volume, 1),
('timestamp', info.timestamp,
INSTANCE_CREATE_END['timestamp']),
('resource_id', info.resource_id,
INSTANCE_CREATE_END['payload']['instance_id']),
('display_name', info.resource_metadata['display_name'],
INSTANCE_CREATE_END['payload']['display_name']),
('instance_type', info.resource_metadata['instance_type'],
INSTANCE_CREATE_END['payload']['instance_type_id']),
('host', info.resource_metadata['host'],
INSTANCE_CREATE_END['publisher_id']),
('counter_name', info.name, 'instance'),
('counter_type', info.type, counter.TYPE_GAUGE),
('counter_volume', info.volume, 1),
('timestamp', info.timestamp,
INSTANCE_CREATE_END['timestamp']),
('resource_id', info.resource_id,
INSTANCE_CREATE_END['payload']['instance_id']),
('instance_type', info.resource_metadata['instance_type'],
INSTANCE_CREATE_END['payload']['instance_type_id']),
('host', info.resource_metadata['host'],
INSTANCE_CREATE_END['publisher_id']),
]:
yield compare, name, actual, expected
self.assertEqual(actual, expected, name)
@staticmethod
def _find_counter(counters, name):