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] 5bed2a8f98
Change-Id: I476e3c573523d5991c56b31ad4df1172196aa7f1
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
parent
f1d691b9f3
commit
723513a9d9
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user