Exemple #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
Exemple #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
Exemple #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
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
Exemple #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
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
Exemple #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
Exemple #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()
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()
Exemple #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)
Exemple #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()
Exemple #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
Exemple #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)
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
Exemple #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
Exemple #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