108
108
self._driver.listen(self._target)
109
109
self.assertEqual(self._server_params[0], self.expected)
111
def test_transport_url_listen_for_notification(self):
112
self._driver.listen_for_notifications(
113
[(messaging.Target(topic='topic'), 'info')])
114
self.assertEqual(self._server_params[0], self.expected)
111
116
def test_transport_url_send(self):
112
117
self._driver.send(self._target, {}, {})
113
118
self.assertEqual(self._server_params[0], self.expected)
605
610
TestReplyWireFormat.generate_scenarios()
613
class RpcKombuHATestCase(test_utils.BaseTestCase):
615
def test_reconnect_order(self):
616
brokers = ['host1', 'host2', 'host3', 'host4', 'host5']
617
brokers_count = len(brokers)
619
self.conf.rabbit_hosts = brokers
620
self.conf.rabbit_max_retries = 1
622
info = {'attempt': 0}
624
def _connect(myself, params):
625
# do as little work that is enough to pass connection attempt
626
myself.connection = kombu.connection.BrokerConnection(**params)
627
myself.connection_errors = myself.connection.connection_errors
629
expected_broker = brokers[info['attempt'] % brokers_count]
630
self.assertEqual(params['hostname'], expected_broker)
634
# just make sure connection instantiation does not fail with an
636
self.stubs.Set(rabbit_driver.Connection, '_connect', _connect)
638
# starting from the first broker in the list
639
connection = rabbit_driver.Connection(self.conf)
641
# now that we have connection object, revert to the real 'connect'
643
self.stubs.UnsetAll()
645
for i in range(len(brokers)):
646
self.assertRaises(driver_common.RPCException, connection.reconnect)