]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Tests: print fake_notifier queue upon mismatch
authorEric Harney <eharney@redhat.com>
Thu, 1 Oct 2015 20:25:17 +0000 (16:25 -0400)
committerEric Harney <eharney@redhat.com>
Thu, 1 Oct 2015 20:31:24 +0000 (16:31 -0400)
If these tests fail, output more information
so it's easier to figure out where things
went wrong.

Related-Bug: #1501745
Related-Bug: #1501839

Change-Id: Id78802834821c791a22c22f49260a8480122cc06

cinder/tests/unit/test_volume.py

index 5000f26981a442caf8d9cef4edf8dc0d429693ba..e5a9a20aa2a586191673bdfc271f990444b0efe2 100644 (file)
@@ -3038,7 +3038,9 @@ class VolumeTestCase(BaseVolumeTestCase):
         self.assertEqual('INFO', msg['priority'])
         if len(self.notifier.notifications) > 2:
             # Cause an assert to print the unexpected item
-            self.assertFalse(self.notifier.notifications[2])
+            # and all of the notifications.
+            self.assertFalse(self.notifier.notifications[2],
+                             self.notifier.notifications)
         self.assertEqual(2, len(self.notifier.notifications),
                          self.notifier.notifications)
 
@@ -3071,7 +3073,9 @@ class VolumeTestCase(BaseVolumeTestCase):
 
         if len(self.notifier.notifications) > 4:
             # Cause an assert to print the unexpected item
-            self.assertFalse(self.notifier.notifications[4])
+            # and all of the notifications.
+            self.assertFalse(self.notifier.notifications[4],
+                             self.notifier.notifications)
 
         self.assertEqual(4, len(self.notifier.notifications),
                          self.notifier.notifications)
@@ -3087,7 +3091,9 @@ class VolumeTestCase(BaseVolumeTestCase):
 
         if len(self.notifier.notifications) > 6:
             # Cause an assert to print the unexpected item
-            self.assertFalse(self.notifier.notifications[6])
+            # and all of the notifications.
+            self.assertFalse(self.notifier.notifications[6],
+                             self.notifier.notifications)
 
         self.assertEqual(6, len(self.notifier.notifications),
                          self.notifier.notifications)
@@ -5092,14 +5098,16 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
         self.assertDictMatch(expected, msg['payload'])
 
         if len(self.notifier.notifications) > 6:
-            self.assertFalse(self.notifier.notifications[6])
+            self.assertFalse(self.notifier.notifications[6],
+                             self.notifier.notifications)
         self.assertEqual(6, len(self.notifier.notifications),
                          self.notifier.notifications)
 
         self.volume.delete_consistencygroup(self.context, group2)
 
         if len(self.notifier.notifications) > 10:
-            self.assertFalse(self.notifier.notifications[10])
+            self.assertFalse(self.notifier.notifications[10],
+                             self.notifier.notifications)
         self.assertEqual(10, len(self.notifier.notifications),
                          self.notifier.notifications)
 
@@ -5291,7 +5299,8 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
         self.volume.create_volume(self.context, volume_id)
 
         if len(self.notifier.notifications) > 2:
-            self.assertFalse(self.notifier.notifications[2])
+            self.assertFalse(self.notifier.notifications[2],
+                             self.notifier.notifications)
         self.assertEqual(2, len(self.notifier.notifications),
                          self.notifier.notifications)
 
@@ -5303,7 +5312,8 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
                                            cgsnapshot_id).id)
 
         if len(self.notifier.notifications) > 6:
-            self.assertFalse(self.notifier.notifications[6])
+            self.assertFalse(self.notifier.notifications[6],
+                             self.notifier.notifications)
 
         msg = self.notifier.notifications[2]
         self.assertEqual('cgsnapshot.create.start', msg['event_type'])
@@ -5331,7 +5341,8 @@ class ConsistencyGroupTestCase(BaseVolumeTestCase):
         self.volume.delete_cgsnapshot(self.context, cgsnapshot_id)
 
         if len(self.notifier.notifications) > 10:
-            self.assertFalse(self.notifier.notifications[10])
+            self.assertFalse(self.notifier.notifications[10],
+                             self.notifier.notifications)
 
         msg = self.notifier.notifications[6]
         self.assertEqual('cgsnapshot.delete.start', msg['event_type'])