def test_produce_100_keyed_gzipped(self):
        """test_produce_100_keyed_gzipped

        Test that gzipping the batch doesn't affect the partition to which
        the messages are assigned, or the order of the messages in the topics

        """
        start_offset = yield self.current_offset(self.topic, 0)

        msg_set = create_message_set([
            SendRequest(self.topic, "Key:%d" % i, ["Test msg %d" % i], None)
            for i in range(100)
        ], CODEC_GZIP)
        yield self.assert_produce_request(
            msg_set,
            start_offset,
            100,
        )
        msgs = ["Test msg %d" % i for i in range(100)]
        keys = ["Key:%d" % i for i in range(100)]
        yield self.assert_fetch_offset(0,
                                       start_offset,
                                       msgs,
                                       expected_keys=keys,
                                       fetch_size=10240)
Example #2
0
def make_send_requests(msgs, topic=None, key=None):
    return [SendRequest(topic, key, msgs, None)]