Changeset View
Changeset View
Standalone View
Standalone View
swh/journal/tests/test_cli.py
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | def test_replay( | ||||
kafka_consumer_group: str, | kafka_consumer_group: str, | ||||
kafka_server: Tuple[Popen, int]): | kafka_server: Tuple[Popen, int]): | ||||
(_, kafka_port) = kafka_server | (_, kafka_port) = kafka_server | ||||
kafka_prefix += '.swh.journal.objects' | kafka_prefix += '.swh.journal.objects' | ||||
producer = Producer({ | producer = Producer({ | ||||
'bootstrap.servers': 'localhost:{}'.format(kafka_port), | 'bootstrap.servers': 'localhost:{}'.format(kafka_port), | ||||
'client.id': 'test-producer', | 'client.id': 'test-producer', | ||||
'enable.idempotence': 'true', | 'acks': 'all', | ||||
}) | }) | ||||
snapshot = {'id': b'foo', 'branches': { | snapshot = {'id': b'foo', 'branches': { | ||||
b'HEAD': { | b'HEAD': { | ||||
'target_type': 'revision', | 'target_type': 'revision', | ||||
'target': b'\x01'*20, | 'target': b'\x01'*20, | ||||
} | } | ||||
}} # type: Dict[str, Any] | }} # type: Dict[str, Any] | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
NUM_CONTENTS = 10 | NUM_CONTENTS = 10 | ||||
def _fill_objstorage_and_kafka(kafka_port, kafka_prefix, objstorages): | def _fill_objstorage_and_kafka(kafka_port, kafka_prefix, objstorages): | ||||
producer = Producer({ | producer = Producer({ | ||||
'bootstrap.servers': '127.0.0.1:{}'.format(kafka_port), | 'bootstrap.servers': '127.0.0.1:{}'.format(kafka_port), | ||||
'client.id': 'test-producer', | 'client.id': 'test-producer', | ||||
'enable.idempotence': 'true', | 'acks': 'all', | ||||
}) | }) | ||||
contents = {} | contents = {} | ||||
for i in range(NUM_CONTENTS): | for i in range(NUM_CONTENTS): | ||||
content = b'\x00'*19 + bytes([i]) | content = b'\x00'*19 + bytes([i]) | ||||
sha1 = objstorages['src'].add(content) | sha1 = objstorages['src'].add(content) | ||||
contents[sha1] = content | contents[sha1] = content | ||||
producer.produce( | producer.produce( | ||||
▲ Show 20 Lines • Show All 473 Lines • Show Last 20 Lines |