From 49b9a547ff75f865ca4a5c6e961a862092943ad6 Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Thu, 19 Dec 2013 15:07:55 +0100 Subject: [PATCH] Don't assume alarms are returned in insert order The previous implentation of the tests assure than the db backends return the alarms into the insert order. This is false for mysql. The patch rewritte the tests to make it compatible to mysql Change-Id: I146de0d8cef78b6c734bc6742238b939422645b9 --- ceilometer/tests/storage/test_storage_scenarios.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ceilometer/tests/storage/test_storage_scenarios.py b/ceilometer/tests/storage/test_storage_scenarios.py index d08ca87d1..6272e7f24 100644 --- a/ceilometer/tests/storage/test_storage_scenarios.py +++ b/ceilometer/tests/storage/test_storage_scenarios.py @@ -2012,9 +2012,10 @@ class AlarmTest(AlarmTestBase, self.add_some_alarms() alarms = list(self.conn.get_alarms()) self.assertEqual(len(alarms), 3) - self.assertEqual(alarms[0].rule['meter_name'], 'test.one') - self.assertEqual(alarms[1].rule['meter_name'], 'test.fourty') - self.assertEqual(alarms[2].rule['meter_name'], 'test.five') + + meter_names = sorted([a.rule['meter_name'] for a in alarms]) + self.assertEqual(meter_names, + ['test.five', 'test.fourty', 'test.one']) def test_update(self): self.add_some_alarms()