swh_storage_backend_config = {'cls': 'local', 'db': 'postgresql://postgres@127.0.0.1:6759/tests', 'journal_writer': {'brokers': ['127.0.0.1:57397'], 'client_id': 'kafka_writer-1', 'cls': 'kafka', 'prefix': 'cnarjszxti-1'}, 'objstorage': {'args': {}, 'cls': 'memory'}}
kafka_prefix = 'cnarjszxti', kafka_consumer_group = 'test-consumer-cnarjszxti'
kafka_server = '127.0.0.1:57397'
@patch("swh.storage.backfill.RANGE_GENERATORS", RANGE_GENERATORS)
def test_backfiller(
swh_storage_backend_config,
kafka_prefix: str,
kafka_consumer_group: str,
kafka_server: str,
):
prefix1 = f"{kafka_prefix}-1"
prefix2 = f"{kafka_prefix}-2"
journal1 = {
"cls": "kafka",
"brokers": [kafka_server],
"client_id": "kafka_writer-1",
"prefix": prefix1,
}
swh_storage_backend_config["journal_writer"] = journal1
storage = get_storage(**swh_storage_backend_config)
# fill the storage and the journal (under prefix1)
for object_type, objects in TEST_OBJECTS.items():
method = getattr(storage, object_type + "_add")
method(objects)
# now apply the backfiller on the storage to fill the journal under prefix2
backfiller_config = {
"brokers": [kafka_server],
"client_id": "kafka_writer-2",
"prefix": prefix2,
"storage_dbconn": swh_storage_backend_config["db"],
}
# Backfilling
backfiller = JournalBackfiller(backfiller_config)
for object_type in TEST_OBJECTS:
> backfiller.run(object_type, None, None)
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_backfill.py:214:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/storage/backfill.py:451: in run
object_type, start_object, end_object
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.backfill.JournalBackfiller object at 0x7fbb3a6ce048>
object_type = 'metadata_authority', start_object = None, end_object = None
def parse_arguments(self, object_type, start_object, end_object):
"""Parse arguments
Raises:
ValueError for unsupported object type
ValueError if object ids are not parseable
Returns:
Parsed start and end object ids
"""
if object_type not in COLUMNS:
raise ValueError(
"Object type %s is not supported. "
"The only possible values are %s"
> % (object_type, ", ".join(COLUMNS.keys()))
)
E ValueError: Object type metadata_authority is not supported. The only possible values are content, skipped_content, directory, revision, release, snapshot, origin, origin_visit, origin_visit_status
.tox/py3/lib/python3.7/site-packages/swh/storage/backfill.py:430: ValueError
TEST RESULT
TEST RESULT
- Run At
- Jul 31 2020, 2:19 PM