diff options
Diffstat (limited to 'oslo_messaging/tests')
-rw-r--r-- | oslo_messaging/tests/drivers/test_pool.py | 4 | ||||
-rw-r--r-- | oslo_messaging/tests/notify/test_notifier.py | 19 |
2 files changed, 15 insertions, 8 deletions
diff --git a/oslo_messaging/tests/drivers/test_pool.py b/oslo_messaging/tests/drivers/test_pool.py index d5c6420..82a10e1 100644 --- a/oslo_messaging/tests/drivers/test_pool.py +++ b/oslo_messaging/tests/drivers/test_pool.py @@ -44,7 +44,7 @@ class PoolTestCase(test_utils.BaseTestCase): class TestPool(pool.Pool): - def create(self): + def create(self, retry=None): return uuid.uuid4() class ThreadWaitWaiter(object): @@ -82,7 +82,7 @@ class PoolTestCase(test_utils.BaseTestCase): p = self.TestPool(**kwargs) if self.create_error: - def create_error(): + def create_error(retry=None): raise RuntimeError orig_create = p.create self.useFixture(fixtures.MockPatchObject( diff --git a/oslo_messaging/tests/notify/test_notifier.py b/oslo_messaging/tests/notify/test_notifier.py index d0a8eca..330bdab 100644 --- a/oslo_messaging/tests/notify/test_notifier.py +++ b/oslo_messaging/tests/notify/test_notifier.py @@ -244,6 +244,10 @@ class TestMessagingNotifierRetry(test_utils.BaseTestCase): topics=["test-retry"], retry=2, group="oslo_messaging_notifications") + self.config( + # just to speed up the test execution + rabbit_retry_backoff=0, + group="oslo_messaging_rabbit") transport = oslo_messaging.get_notification_transport( self.conf, url='rabbit://') notifier = oslo_messaging.Notifier(transport) @@ -264,12 +268,15 @@ class TestMessagingNotifierRetry(test_utils.BaseTestCase): 'kombu.connection.Connection._establish_connection', new=wrapped_establish_connection ): - # FIXME(gibi) This is bug 1917645 as the driver does not stop - # retrying the connection after two retries only our test fixture - # stops the retry by raising TestingException - self.assertRaises( - self.TestingException, - notifier.info, {}, "test", {}) + with mock.patch( + 'oslo_messaging.notify.messaging.LOG.exception' + ) as mock_log: + notifier.info({}, "test", {}) + + # one normal call plus two retries + self.assertEqual(3, len(calls)) + # the error was caught and logged + mock_log.assert_called_once() def test_notifier_retry_connection_fails_kafka(self): """This test sets a small retry number for notification sending and |