コード例 #1
0
    def setUp(self):
        super(RpcKombuHATestCase, self).setUp()
        transport_url = 'rabbit:/host1,host2,host3,host4,host5/'
        self.messaging_conf.transport_url = transport_url
        self.config(rabbit_retry_interval=0.01,
                    rabbit_retry_backoff=0.01,
                    kombu_reconnect_delay=0,
                    heartbeat_timeout_threshold=0,
                    group="oslo_messaging_rabbit")

        self.useFixture(fixtures.MockPatch(
            '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)
        # 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)
コード例 #2
0
    def setUp(self):
        super(RpcKombuHATestCase, self).setUp()
        self.brokers = ['host1', 'host2', 'host3', 'host4', 'host5']
        self.config(rabbit_hosts=self.brokers,
                    rabbit_retry_interval=0.01,
                    rabbit_retry_backoff=0.01,
                    kombu_reconnect_delay=0)

        self.kombu_connect = mock.Mock()
        self.useFixture(
            mockpatch.Patch('kombu.connection.Connection.connect',
                            side_effect=self.kombu_connect))
        self.useFixture(mockpatch.Patch('kombu.connection.Connection.channel'))

        # starting from the first broker in the list
        url = messaging.TransportURL.parse(self.conf, None)
        self.connection = rabbit_driver.Connection(self.conf, url)
        self.addCleanup(self.connection.close)
コード例 #3
0
    def setUp(self):
        super(RpcKombuHATestCase, self).setUp()
        self.brokers = ['host1', 'host2', 'host3', 'host4', 'host5']
        self.config(rabbit_hosts=self.brokers,
                    rabbit_retry_interval=0.01,
                    rabbit_retry_backoff=0.01,
                    kombu_reconnect_delay=0,
                    heartbeat_timeout_threshold=0,
                    group="oslo_messaging_rabbit")

        self.useFixture(
            fixtures.MockPatch('kombu.connection.Connection.connection'))
        self.useFixture(
            fixtures.MockPatch('kombu.connection.Connection.channel'))

        # 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'))
        self.addCleanup(self.connection.close)