summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2022-04-05 17:19:13 +0100
committerStephen Finucane <sfinucan@redhat.com>2022-04-05 17:19:13 +0100
commit723513a9d95b6d7678cc851afdfafba41120693c (patch)
tree90ce821d76fd550c24b0c60bb7346c23b9402b28
parentf1d691b9f369e0be1379f45f859b0a21d9d23188 (diff)
downloadoslo-messaging-723513a9d95b6d7678cc851afdfafba41120693c.tar.gz
tests: Fix test failures with kombu >= 5.2.4
kombu 5.2.4 fixed an off-by-one issue that meant we were attempting retries more than once [1]. We need to handle this to unblock the gate. This was discovered by examining the call stack and comparing this with recent changes in openstack/requirements. [1] https://github.com/celery/kombu/commit/5bed2a8f983a3bf61c12443e7704ffd89991ef9a Change-Id: I476e3c573523d5991c56b31ad4df1172196aa7f1 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
-rw-r--r--oslo_messaging/tests/drivers/test_impl_rabbit.py27
1 files changed, 21 insertions, 6 deletions
diff --git a/oslo_messaging/tests/drivers/test_impl_rabbit.py b/oslo_messaging/tests/drivers/test_impl_rabbit.py
index 8955661..34c396b 100644
--- a/oslo_messaging/tests/drivers/test_impl_rabbit.py
+++ b/oslo_messaging/tests/drivers/test_impl_rabbit.py
@@ -1008,21 +1008,36 @@ class RpcKombuHATestCase(test_utils.BaseTestCase):
self.assertRaises(oslo_messaging.MessageDeliveryFailure,
self.connection.ensure, mock_callback,
retry=4)
- self.assertEqual(6, mock_callback.call_count)
+ # TODO(stephenfin): Remove when we drop support for kombu < 5.2.4
+ expected = 5
+ if kombu.VERSION < (5, 2, 4):
+ expected = 6
+ self.assertEqual(expected, mock_callback.call_count)
def test_ensure_one_retry(self):
mock_callback = mock.Mock(side_effect=IOError)
self.assertRaises(oslo_messaging.MessageDeliveryFailure,
self.connection.ensure, mock_callback,
retry=1)
- self.assertEqual(3, mock_callback.call_count)
+ # TODO(stephenfin): Remove when we drop support for kombu < 5.2.4
+ expected = 2
+ if kombu.VERSION < (5, 2, 4):
+ expected = 3
+ self.assertEqual(expected, mock_callback.call_count)
def test_ensure_no_retry(self):
mock_callback = mock.Mock(side_effect=IOError)
- self.assertRaises(oslo_messaging.MessageDeliveryFailure,
- self.connection.ensure, mock_callback,
- retry=0)
- self.assertEqual(2, mock_callback.call_count)
+ self.assertRaises(
+ oslo_messaging.MessageDeliveryFailure,
+ self.connection.ensure,
+ mock_callback,
+ retry=0,
+ )
+ # TODO(stephenfin): Remove when we drop support for kombu < 5.2.4
+ expected = 1
+ if kombu.VERSION < (5, 2, 4):
+ expected = 2
+ self.assertEqual(expected, mock_callback.call_count)
class ConnectionLockTestCase(test_utils.BaseTestCase):