Exemplo n.º 1
0
    def setUp(self):
        # Dummy client for testing - we're not going to connect that bootstrap broker
        self.client = Client()

        # Get the broker and topic from a metadata update
        self.client._update_from_metadata(topic_metadata())

        self.list_offset = list_offset()
        self.list_offset_error = list_offset_error()
        self.list_offset_request = {
            1: {
                'replica_id':
                -1,
                'topics': [{
                    'topic':
                    'topic1',
                    'partitions': [{
                        'partition': 0,
                        'timestamp': Client.OFFSET_LATEST,
                        'max_num_offsets': 1
                    }, {
                        'partition': 1,
                        'timestamp': Client.OFFSET_EARLIEST,
                        'max_num_offsets': 1
                    }]
                }]
            }
        }
Exemplo n.º 2
0
    def setUp(self):
        # Dummy client for testing - we're not going to connect that bootstrap broker
        self.client = Client()
        self.client._connected = True

        # Get the broker and topic from a metadata update
        self.client._update_from_metadata(topic_metadata())

        self.group = Group('testgroup')
        self.offset_fetch = offset_fetch()
Exemplo n.º 3
0
    def setUp(self):
        # Dummy client for testing - we're not going to connect that bootstrap broker
        self.client = Client()
        self.client._connected = True

        # Two brokers for the client
        broker = Broker('host1.example.com', id=1, port=8031)
        broker.rack = 'rack1'
        self.client.cluster.add_broker(broker)
        broker = Broker('host2.example.com', id=101, port=8032)
        broker.rack = 'rack1'
        self.client.cluster.add_broker(broker)

        self.metadata = topic_metadata()
        self.metadata_error = topic_metadata_error()
Exemplo n.º 4
0
 def setUp(self):
     # Dummy client for testing - we're not going to connect that bootstrap broker
     self.client = Client()
     self.metadata_response = topic_metadata()
Exemplo n.º 5
0
 def setUp(self):
     # Dummy client for testing - we're not going to connect that bootstrap broker
     self.client = Client()
     self.describe_groups = describe_groups()
Exemplo n.º 6
0
 def setUp(self):
     # Dummy client for testing - we're not going to connect that bootstrap broker
     self.client = Client()
     self.group_coordinator = group_coordinator()
     self.coordinator_error = group_coordinator_error()
Exemplo n.º 7
0
 def test_connect_zookeeper(self, mock_create):
     mock_create.return_value = Cluster()
     test_client = Client(zkconnect='zk.example.com:2181/kafka-cluster')
     test_client.connect()
     mock_create.assert_called_once_with(
         zkconnect='zk.example.com:2181/kafka-cluster', fetch_topics=False)
Exemplo n.º 8
0
 def test_create_config_zkconnect(self):
     test_client = Client(zkconnect='zk.example.com:2181/kafka-cluster')
     assert test_client.configuration.zkconnect == 'zk.example.com:2181/kafka-cluster'
Exemplo n.º 9
0
 def test_create_with_configuration(self):
     config = ClientConfiguration(
         zkconnect='zk.example.com:2181/kafka-cluster')
     client = Client(configuration=config)
     assert client.configuration == config
Exemplo n.º 10
0
 def setUp(self):
     # Dummy client for testing - we're not going to connect that bootstrap broker
     self.client = Client(
         broker_list='broker1.example.com:9091,broker2.example.com:9092')
     self.client._connected = True
     self.metadata_response = topic_metadata()