kafka_prefix = 'ftpywlqlqy', kafka_server = '127.0.0.1:40039'
consumer = <cimpl.Consumer object at 0x7f23503f2158>
def test_storage_direct_writer(kafka_prefix: str, kafka_server, consumer: Consumer):
writer_config = {
"cls": "kafka",
"brokers": [kafka_server],
"client_id": "kafka_writer",
"prefix": kafka_prefix,
"anonymize": False,
}
storage_config: Dict[str, Any] = {
"cls": "pipeline",
"steps": [{"cls": "memory", "journal_writer": writer_config},],
}
storage = get_storage(**storage_config)
expected_messages = 0
for obj_type, objs in TEST_OBJECTS.items():
method = getattr(storage, obj_type + "_add")
if obj_type in (
"content",
"skipped_content",
"directory",
"metadata_authority",
"metadata_fetcher",
"revision",
"release",
"snapshot",
"origin",
"origin_visit_status",
"raw_extrinsic_metadata",
):
method(objs)
expected_messages += len(objs)
elif obj_type in ("origin_visit",):
for obj in objs:
assert isinstance(obj, OriginVisit)
storage.origin_add([Origin(url=obj.origin)])
method([obj])
expected_messages += 1 + 1 # 1 visit + 1 visit status
else:
assert False, obj_type
existing_topics = set(
topic
for topic in consumer.list_topics(timeout=10).topics.keys()
if topic.startswith(f"{kafka_prefix}.") # final . to exclude privileged topics
)
> assert existing_topics == {
f"{kafka_prefix}.{obj_type}"
for obj_type in (
"content",
"directory",
"metadata_authority",
"metadata_fetcher",
"origin",
"origin_visit",
"origin_visit_status",
"raw_extrinsic_metadata",
"release",
"revision",
"snapshot",
"skipped_content",
)
}
E AssertionError: assert {'ftpywlqlqy....release', ...} == {'ftpywlqlqy....n_visit', ...}
E Extra items in the right set:
E 'ftpywlqlqy.raw_extrinsic_metadata'
E 'ftpywlqlqy.metadata_authority'
E 'ftpywlqlqy.metadata_fetcher'
E Full diff:
E {
E 'ftpywlqlqy.content',...
E
E ...Full output truncated (13 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_kafka_writer.py:71: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jul 31 2020, 10:20 AM