Esempio n. 1
0
def step_impl3(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        current_config = zk.get_topic_config(context.topic)
        current_config['config']['max.message.bytes'] = '1000'
        zk.set_topic_config(context.topic, value=current_config)
    time.sleep(2)  # sleeping for 2 seconds to ensure config is actually picked up
Esempio n. 2
0
def step_impl5(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        offsets = zk.get_group_offsets(context.group)
        new_offsets = zk.get_group_offsets(NEW_GROUP)
    assert context.topic in offsets
    assert new_offsets == offsets
Esempio n. 3
0
def fetch_offsets(group, topics):
    # Setup the Kafka client
    config = get_cluster_config()
    client = KafkaToolClient(config.broker_list)
    offsets = get_current_consumer_offsets(client, group, topics, False)
    client.close()
    return offsets
Esempio n. 4
0
def fetch_offsets(group, topics):
    # Setup the Kafka client
    config = get_cluster_config()
    client = KafkaToolClient(config.broker_list)
    offsets = get_current_consumer_offsets(client, group, topics, False)
    client.close()
    return offsets
Esempio n. 5
0
def step_impl3(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        current_config = zk.get_topic_config(context.topic)
        current_config['config']['max.message.bytes'] = '1000'
        zk.set_topic_config(context.topic, value=current_config)
    time.sleep(
        2)  # sleeping for 2 seconds to ensure config is actually picked up
Esempio n. 6
0
def step_impl5(context):
    config = get_cluster_config()
    context.client = KafkaToolClient(config.broker_list)
    offsets = get_current_consumer_offsets(
        context.client,
        context.group,
        [context.topic],
    )
    assert offsets[context.topic][0] == 0
Esempio n. 7
0
def step_impl3(context):
    config = get_cluster_config()
    context.client = KafkaToolClient(config.broker_list)
    offsets = get_current_consumer_offsets(
        context.client,
        context.group,
        [context.topic],
    )
    assert offsets[context.topic][0] == SET_OFFSET_KAFKA
Esempio n. 8
0
def commit_offsets(offsets, group):
    # Setup the Kafka client
    config = get_cluster_config()
    client = KafkaToolClient(config.broker_list)
    set_consumer_offsets(
        client,
        group,
        offsets,
    )
    client.close()
Esempio n. 9
0
def commit_offsets(offsets, group):
    # Setup the Kafka client
    config = get_cluster_config()
    client = KafkaToolClient(config.broker_list)
    set_consumer_offsets(
        client,
        group,
        offsets,
    )
    client.close()
Esempio n. 10
0
def set_min_isr(topic, min_isr):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        config = zk.get_topic_config(topic)
        config['config'] = {ISR_CONF_NAME: str(min_isr)}
        zk.set_topic_config(topic, config)
Esempio n. 11
0
def step_impl4(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        offsets = zk.get_group_offsets(context.group)
    assert offsets[context.topic]["0"] == RESTORED_OFFSET
    context.offsets_file.close()
Esempio n. 12
0
def step_impl3(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        offsets = zk.get_group_offsets(context.group)
    assert offsets[context.topic]["0"] == SET_OFFSET
Esempio n. 13
0
def set_min_isr(topic, min_isr):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        config = zk.get_topic_config(topic)
        config['config'] = {ISR_CONF_NAME: str(min_isr)}
        zk.set_topic_config(topic, config)
Esempio n. 14
0
def step_impl4(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        offsets = zk.get_group_offsets(context.group)
    assert context.topic not in offsets
Esempio n. 15
0
def step_impl4(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        offsets = zk.get_group_offsets(context.group)
    assert offsets[context.topic]["0"] == context.msgs_produced
Esempio n. 16
0
def step_impl4(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        offsets = zk.get_group_offsets(context.group)
    assert offsets[context.topic]["0"] == context.msgs_produced