reformat the event time
the time retruned from the alarm is reformated to hava a time zonce Change-Id: Ib8f46729007342789e41e59771abf7a78aaa2687
This commit is contained in:
parent
87ea080c04
commit
d5cd8a991a
@ -43,7 +43,8 @@ class TestEvents(base.BaseTestCase):
|
|||||||
"""Sending an event in Doctor format should result in an alarm"""
|
"""Sending an event in Doctor format should result in an alarm"""
|
||||||
try:
|
try:
|
||||||
# post an event to the message bus
|
# post an event to the message bus
|
||||||
event_time = datetime.now().isoformat()
|
event_time = datetime.now()
|
||||||
|
event_time_iso = event_time.isoformat()
|
||||||
event_type = 'compute.host.down'
|
event_type = 'compute.host.down'
|
||||||
details = {
|
details = {
|
||||||
'hostname': 'host123',
|
'hostname': 'host123',
|
||||||
@ -55,7 +56,7 @@ class TestEvents(base.BaseTestCase):
|
|||||||
'monitor_event_id': '456',
|
'monitor_event_id': '456',
|
||||||
}
|
}
|
||||||
|
|
||||||
self.vitrage_client.event.post(event_time, event_type, details)
|
self.vitrage_client.event.post(event_time_iso, event_type, details)
|
||||||
|
|
||||||
# list all alarms
|
# list all alarms
|
||||||
api_alarms = self.vitrage_client.alarm.list(vitrage_id='all',
|
api_alarms = self.vitrage_client.alarm.list(vitrage_id='all',
|
||||||
@ -66,10 +67,11 @@ class TestEvents(base.BaseTestCase):
|
|||||||
self.assertEqual(1, len(api_alarms), 'Expected host down alarm')
|
self.assertEqual(1, len(api_alarms), 'Expected host down alarm')
|
||||||
alarm = api_alarms[0]
|
alarm = api_alarms[0]
|
||||||
|
|
||||||
|
event_time_tz = event_time.strftime("%Y-%m-%d %H:%M:%SZ")
|
||||||
self._wait_for_status(2,
|
self._wait_for_status(2,
|
||||||
self._check_alarm,
|
self._check_alarm,
|
||||||
alarm=alarm,
|
alarm=alarm,
|
||||||
event_time=event_time,
|
event_time=event_time_tz,
|
||||||
event_type=event_type,
|
event_type=event_type,
|
||||||
details=details)
|
details=details)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user