diff --git a/requirements-swh.txt b/requirements-swh.txt --- a/requirements-swh.txt +++ b/requirements-swh.txt @@ -2,5 +2,5 @@ swh.model >= 0.0.15 swh.objstorage >= 0.0.43 swh.scheduler >= 0.0.47 -swh.storage >= 0.2.0 +swh.storage >= 0.3.0 swh.journal >= 0.1.0 diff --git a/swh/indexer/tests/test_origin_head.py b/swh/indexer/tests/test_origin_head.py --- a/swh/indexer/tests/test_origin_head.py +++ b/swh/indexer/tests/test_origin_head.py @@ -6,7 +6,7 @@ import unittest from datetime import datetime, timezone -from swh.model.model import OriginVisitStatus +from swh.model.model import OriginVisit, OriginVisitStatus from swh.indexer.origin_head import OriginHeadIndexer from swh.indexer.tests.utils import BASE_TEST_CONFIG, fill_storage from swh.storage.utils import now @@ -56,8 +56,16 @@ {"url": origin_url,} ) visit = self.indexer.storage.origin_visit_add( - origin_url, datetime(2019, 2, 27, tzinfo=timezone.utc), type="git" - ) + [ + OriginVisit( + origin=origin_url, + date=datetime(2019, 2, 27, tzinfo=timezone.utc), + type="git", + status="ongoing", + snapshot=None, + ) + ] + )[0] self.indexer.storage.snapshot_add( [ { @@ -93,8 +101,16 @@ {"url": origin_url,} ) visit = self.indexer.storage.origin_visit_add( - origin_url, datetime(2019, 2, 27, tzinfo=timezone.utc), type="pypi" - ) + [ + OriginVisit( + origin=origin_url, + date=datetime(2019, 2, 27, tzinfo=timezone.utc), + type="pypi", + status="ongoing", + snapshot=None, + ) + ] + )[0] self.indexer.storage.snapshot_add( [ { diff --git a/swh/indexer/tests/utils.py b/swh/indexer/tests/utils.py --- a/swh/indexer/tests/utils.py +++ b/swh/indexer/tests/utils.py @@ -13,7 +13,7 @@ from swh.model import hashutil from swh.model.hashutil import hash_to_bytes, hash_to_hex -from swh.model.model import OriginVisitStatus +from swh.model.model import OriginVisit, OriginVisitStatus from swh.storage.utils import now from swh.indexer.storage import INDEXER_CFG_KEY @@ -510,8 +510,16 @@ for snap in SNAPSHOTS: origin_url = snap["origin"] visit = storage.origin_visit_add( - origin_url, date=now(), type=visit_types[origin_url] - ) + [ + OriginVisit( + origin=origin_url, + date=now(), + type=visit_types[origin_url], + status="ongoing", + snapshot=None, + ) + ] + )[0] snap_id = snap.get("id") or bytes([random.randint(0, 255) for _ in range(32)]) storage.snapshot_add([{"id": snap_id, "branches": snap["branches"]}]) visit_status = OriginVisitStatus(