Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/tests/test_backfill.py
Show All 28 Lines | def test_config_ko_missing_mandatory_key(): | ||||
""" | """ | ||||
for key in TEST_CONFIG.keys(): | for key in TEST_CONFIG.keys(): | ||||
config = TEST_CONFIG.copy() | config = TEST_CONFIG.copy() | ||||
config.pop(key) | config.pop(key) | ||||
with pytest.raises(ValueError) as e: | with pytest.raises(ValueError) as e: | ||||
JournalBackfiller(config) | JournalBackfiller(config) | ||||
error = "Configuration error: The following keys must be" " provided: %s" % ( | error = "Configuration error: The following keys must be provided: %s" % ( | ||||
",".join([key]), | ",".join([key]), | ||||
) | ) | ||||
assert e.value.args[0] == error | assert e.value.args[0] == error | ||||
def test_config_ko_unknown_object_type(): | def test_config_ko_unknown_object_type(): | ||||
"""Parse arguments will fail if the object type is unknown | """Parse arguments will fail if the object type is unknown | ||||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | where (release.id) >= %s and (release.id) < %s | ||||
""" # noqa | """ # noqa | ||||
) | ) | ||||
RANGE_GENERATORS = { | RANGE_GENERATORS = { | ||||
"content": lambda start, end: [(None, None)], | "content": lambda start, end: [(None, None)], | ||||
"skipped_content": lambda start, end: [(None, None)], | "skipped_content": lambda start, end: [(None, None)], | ||||
"directory": lambda start, end: [(None, None)], | "directory": lambda start, end: [(None, None)], | ||||
"metadata_authority": lambda start, end: [(None, None)], | |||||
"metadata_fetcher": lambda start, end: [(None, None)], | |||||
"revision": lambda start, end: [(None, None)], | "revision": lambda start, end: [(None, None)], | ||||
"release": lambda start, end: [(None, None)], | "release": lambda start, end: [(None, None)], | ||||
"snapshot": lambda start, end: [(None, None)], | "snapshot": lambda start, end: [(None, None)], | ||||
"origin": lambda start, end: [(None, 10000)], | "origin": lambda start, end: [(None, 10000)], | ||||
"origin_visit": lambda start, end: [(None, 10000)], | "origin_visit": lambda start, end: [(None, 10000)], | ||||
"origin_visit_status": lambda start, end: [(None, 10000)], | "origin_visit_status": lambda start, end: [(None, 10000)], | ||||
"raw_extrinsic_metadata": lambda start, end: [(None, None)], | |||||
} | } | ||||
@patch("swh.storage.backfill.RANGE_GENERATORS", RANGE_GENERATORS) | @patch("swh.storage.backfill.RANGE_GENERATORS", RANGE_GENERATORS) | ||||
def test_backfiller( | def test_backfiller( | ||||
swh_storage_backend_config, | swh_storage_backend_config, | ||||
kafka_prefix: str, | kafka_prefix: str, | ||||
kafka_consumer_group: str, | kafka_consumer_group: str, | ||||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |