Changeset View
Standalone View
swh/loader/mercurial/tests/test_from_disk.py
Show First 20 Lines • Show All 241 Lines • ▼ Show 20 Lines | for rev in loader.storage.revision_log(revisions): | ||||
if k == b"transplant_source": | if k == b"transplant_source": | ||||
transplant_sources.add(v.decode("ascii")) | transplant_sources.add(v.decode("ascii")) | ||||
# check extracted data are valid | # check extracted data are valid | ||||
assert len(hg_changesets) > 0 | assert len(hg_changesets) > 0 | ||||
assert len(transplant_sources) > 0 | assert len(transplant_sources) > 0 | ||||
assert transplant_sources.issubset(hg_changesets) | assert transplant_sources.issubset(hg_changesets) | ||||
ardumont: after the rebase, `swh_config` fixture needs to be changed to the fixture `swh_storage` and ... | |||||
def test_load_unchanged_repo_should_be_uneventfull(swh_storage, datadir, tmp_path): | def test_load_unchanged_repo_should_be_uneventfull(swh_storage, datadir, tmp_path): | ||||
archive_name = "hello" | archive_name = "hello" | ||||
archive_path = os.path.join(datadir, f"{archive_name}.tgz") | archive_path = os.path.join(datadir, f"{archive_name}.tgz") | ||||
repo_url = prepare_repository_from_archive(archive_path, archive_name, tmp_path) | repo_url = prepare_repository_from_archive(archive_path, archive_name, tmp_path) | ||||
repo_path = repo_url.replace("file://", "") | repo_path = repo_url.replace("file://", "") | ||||
loader = HgLoaderFromDisk(swh_storage, repo_path) | loader = HgLoaderFromDisk(swh_storage, repo_path) | ||||
Done Inline Actions... swh_storage needs to be passed along to the constructor loader now... ardumont: ... swh_storage needs to be passed along to the constructor loader now... | |||||
assert loader.load() == {"status": "eventful"} | assert loader.load() == {"status": "eventful"} | ||||
Done Inline Actions... and the visit_date needs to be a datetime.datetime instance. ardumont: ... and the visit_date needs to be a datetime.datetime instance.
(there is possibly a global… | |||||
assert get_stats(loader.storage) == { | assert get_stats(loader.storage) == { | ||||
"content": 3, | "content": 3, | ||||
"directory": 3, | "directory": 3, | ||||
"origin": 1, | "origin": 1, | ||||
"origin_visit": 1, | "origin_visit": 1, | ||||
"release": 1, | "release": 1, | ||||
"revision": 3, | "revision": 3, | ||||
"skipped_content": 0, | "skipped_content": 0, | ||||
"snapshot": 1, | "snapshot": 1, | ||||
} | } | ||||
assert loader.load() == {"status": "uneventful"} | assert loader.load() == {"status": "uneventful"} | ||||
assert get_stats(loader.storage) == { | assert get_stats(loader.storage) == { | ||||
"content": 3, | "content": 3, | ||||
"directory": 3, | "directory": 3, | ||||
"origin": 1, | "origin": 1, | ||||
"origin_visit": 2, | "origin_visit": 2, | ||||
"release": 1, | "release": 1, | ||||
"revision": 3, | "revision": 3, | ||||
"skipped_content": 0, | "skipped_content": 0, | ||||
"snapshot": 1, | "snapshot": 1, | ||||
} | } | ||||
def test_missing_filelog_should_not_crash(swh_storage, datadir, tmp_path): | |||||
archive_name = "missing-filelog" | |||||
archive_path = os.path.join(datadir, f"{archive_name}.tgz") | |||||
repo_url = prepare_repository_from_archive(archive_path, archive_name, tmp_path) | |||||
directory = repo_url.replace("file://", "") | |||||
loader = HgLoaderFromDisk( | |||||
storage=swh_storage, | |||||
url=repo_url, | |||||
directory=directory, # specify directory to avoid clone | |||||
visit_date=VISIT_DATE, | |||||
) | |||||
actual_load_status = loader.load() | |||||
assert actual_load_status == {"status": "eventful"} | |||||
ardumontUnsubmitted Not Done Inline ActionsWhat's the visit status for such case? It should be partial i think since we are not able to load everything. Please add the missing assertions on those visit (cf. [1] as example) ardumont: What's the visit status for such case?
It should be `partial` i think since we are not able to… | |||||
AlphareAuthorUnsubmitted Done Inline ActionsShould the load status and the visit status be different? I'm not sure I understand the semantics right. Alphare: Should the `load` status and the `visit` status be different? I'm not sure I understand the… | |||||
ardumontUnsubmitted Not Done Inline ActionsYes, they are different. They are not the same and do not share most of their values. The load status is used by the scheduler, it's only eventful or uneventful (i'm not even sure failed is possible). It's the actual (celery) task status. It's a remnant from our current scheduler which we are currently reworking. visit status is the most important one now as it has been more adequately refined in the storage (archive). ardumont: Yes, they are different. They are not the same and do not share most of their values.
The load… |
after the rebase, swh_config fixture needs to be changed to the fixture swh_storage and ...