summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2020-07-01 15:01:00 +0100
committerStephen Finucane <sfinucan@redhat.com>2020-07-02 10:37:09 +0100
commitafb035d97185fa9c622bdb9b4c31c71f01160370 (patch)
tree4799b68daebe436cd5a92c1d022cf58148f9c515
parent7e406c312a6514e7ae377edb52b9e02b5bf37a7d (diff)
downloadoslo-messaging-afb035d97185fa9c622bdb9b4c31c71f01160370.tar.gz
tests: Resolves issues with kombu > 4.6.812.2.1
The 'kombu.connection.Connection.ensure_connection' method has changed from calling 'retry_over_time' on 'self.connect' to calling it on 'self._connection_factory' [1], meaning our mocks are outdated. Address this change. [1] https://github.com/celery/kombu/pull/1193/commits/398aa5b8cd1fe1fc Change-Id: Ibbcf21a57ab1e3f90c21901296e5c088b645127c Signed-off-by: Stephen Finucane <sfinucan@redhat.com> Closes-Bug: #1885923
-rw-r--r--oslo_messaging/tests/drivers/test_impl_rabbit.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/oslo_messaging/tests/drivers/test_impl_rabbit.py b/oslo_messaging/tests/drivers/test_impl_rabbit.py
index 2966bb5..e70a778 100644
--- a/oslo_messaging/tests/drivers/test_impl_rabbit.py
+++ b/oslo_messaging/tests/drivers/test_impl_rabbit.py
@@ -17,11 +17,11 @@ import ssl
import sys
import threading
import time
-import unittest
import uuid
import fixtures
import kombu
+import kombu.connection
import kombu.transport.memory
from oslo_serialization import jsonutils
from oslo_utils import eventletutils
@@ -973,16 +973,21 @@ class RpcKombuHATestCase(test_utils.BaseTestCase):
'kombu.connection.Connection.connection'))
self.useFixture(fixtures.MockPatch(
'kombu.connection.Connection.channel'))
+ # TODO(stephenfin): Drop hasattr when we drop support for kombo < 4.6.8
+ if hasattr(kombu.connection.Connection, '_connection_factory'):
+ self.useFixture(fixtures.MockPatch(
+ 'kombu.connection.Connection._connection_factory'))
# starting from the first broker in the list
url = oslo_messaging.TransportURL.parse(self.conf, None)
self.connection = rabbit_driver.Connection(self.conf, url,
driver_common.PURPOSE_SEND)
- self.useFixture(fixtures.MockPatch(
- 'kombu.connection.Connection.connect'))
+ # TODO(stephenfin): Remove when we drop support for kombo < 4.6.8
+ if hasattr(kombu.connection.Connection, 'connect'):
+ self.useFixture(fixtures.MockPatch(
+ 'kombu.connection.Connection.connect'))
self.addCleanup(self.connection.close)
- @unittest.skip("bug #1885923")
def test_ensure_four_retry(self):
mock_callback = mock.Mock(side_effect=IOError)
self.assertRaises(oslo_messaging.MessageDeliveryFailure,
@@ -990,7 +995,6 @@ class RpcKombuHATestCase(test_utils.BaseTestCase):
retry=4)
self.assertEqual(6, mock_callback.call_count)
- @unittest.skip("bug #1885923")
def test_ensure_one_retry(self):
mock_callback = mock.Mock(side_effect=IOError)
self.assertRaises(oslo_messaging.MessageDeliveryFailure,
@@ -998,7 +1002,6 @@ class RpcKombuHATestCase(test_utils.BaseTestCase):
retry=1)
self.assertEqual(3, mock_callback.call_count)
- @unittest.skip("bug #1885923")
def test_ensure_no_retry(self):
mock_callback = mock.Mock(side_effect=IOError)
self.assertRaises(oslo_messaging.MessageDeliveryFailure,