Changeset View
Changeset View
Standalone View
Standalone View
swh/journal/tests/test_cli.py
Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | def _fill_objstorage_and_kafka(kafka_port, kafka_prefix, objstorages): | ||||
contents = {} | contents = {} | ||||
for i in range(10): | for i in range(10): | ||||
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( | ||||
topic=kafka_prefix+'.content', | topic=kafka_prefix+'.content', | ||||
key=key_to_kafka(sha1), | key=key_to_kafka(sha1), | ||||
value=key_to_kafka({ | value=value_to_kafka({ | ||||
'sha1': sha1, | 'sha1': sha1, | ||||
'status': 'visible', | 'status': 'visible', | ||||
}), | }), | ||||
) | ) | ||||
producer.flush() | producer.flush() | ||||
return contents | return contents | ||||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |