Changeset View
Changeset View
Standalone View
Standalone View
swh/objstorage/replayer/tests/test_statsd.py
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | def test_replay_statsd(kafka_server, kafka_prefix, kafka_consumer_group, statsd): | ||||
contents = [ | contents = [ | ||||
Content.from_data( | Content.from_data( | ||||
f"foo{i}".encode(), status="hidden" if 6 <= i < 8 else "visible" | f"foo{i}".encode(), status="hidden" if 6 <= i < 8 else "visible" | ||||
) | ) | ||||
for i in range(8) | for i in range(8) | ||||
] | ] | ||||
for content in contents: | for content in contents: | ||||
objstorage1.add(content.data) | objstorage1.add(content.data, obj_id=content.sha1) | ||||
writer.write_addition("content", content) | writer.write_addition("content", content) | ||||
excluded = [c.sha1 for c in contents[2:4]] | excluded = [c.sha1 for c in contents[2:4]] | ||||
def exclude_fn(cnt_d): | def exclude_fn(cnt_d): | ||||
return cnt_d["sha1"] in excluded | return cnt_d["sha1"] in excluded | ||||
for content in contents[4:6]: | for content in contents[4:6]: | ||||
objstorage2.add(content.data) | objstorage2.add(content.data, obj_id=content.sha1) | ||||
replayer = JournalClient( | replayer = JournalClient( | ||||
brokers=kafka_server, | brokers=kafka_server, | ||||
group_id=kafka_consumer_group, | group_id=kafka_consumer_group, | ||||
prefix=kafka_prefix, | prefix=kafka_prefix, | ||||
stop_on_eof=True, | stop_on_eof=True, | ||||
# stop_after_objects=len(objects), | # stop_after_objects=len(objects), | ||||
) | ) | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |