def step_impl5_3(context): offset = context.msgs_consumed if context.msgs_produced > 0.0: percentage_distance = round((context.msgs_produced - offset) * 100.0 / context.msgs_produced, 2) else: percentage_distance = 0.0 parsed_output = load_json(context.output) assert parsed_output == [ { "topic": context.topic, "partition": 0, "current": offset, "highmark": context.msgs_produced, "lowmark": 0, "offset_distance": context.msgs_produced - offset, "percentage_distance": percentage_distance } ]
def step_impl3_2(context): offset = context.restored_offset data = load_json(context.offsets_file.read()) assert offset == data['offsets'][context.topic]['0'] context.offsets_file.close()
def step_impl3(context): offset = context.msgs_consumed data = load_json(context.offsets_file.read()) assert offset == data['offsets'][context.topic]['0'] context.offsets_file.close()