Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.storage.tests.test_storage.TestStorage::test_origin_visit_status_get_latest
Failed

TEST RESULT

Run At
Jul 9 2020, 10:49 AM
Details
self = <swh.storage.tests.test_storage.TestStorage object at 0x7f1bc9c66978> swh_storage = <swh.storage.validate.ValidatingProxyStorage object at 0x7f1bc9c8af60> def test_origin_visit_status_get_latest(self, swh_storage): origin1 = Origin.from_dict(data.origin) swh_storage.origin_add_one(data.origin) # to have some reference visits ov1, ov2 = swh_storage.origin_visit_add( [ OriginVisit( origin=origin1.url, date=data.date_visit1, type=data.type_visit1, ), OriginVisit( origin=origin1.url, date=data.date_visit2, type=data.type_visit2, ), ] ) snapshot = Snapshot.from_dict(data.complete_snapshot) swh_storage.snapshot_add([snapshot]) date_now = now() date_now = round_to_milliseconds(date_now) assert data.date_visit1 < data.date_visit2 assert data.date_visit2 < date_now ovs1 = OriginVisitStatus( origin=origin1.url, visit=ov1.visit, date=data.date_visit1, status="partial", snapshot=None, ) ovs2 = OriginVisitStatus( origin=origin1.url, visit=ov1.visit, date=data.date_visit2, status="ongoing", snapshot=None, ) ovs3 = OriginVisitStatus( origin=origin1.url, visit=ov2.visit, date=data.date_visit2 + datetime.timedelta(minutes=1), # to not be ignored status="ongoing", snapshot=None, ) ovs4 = OriginVisitStatus( origin=origin1.url, visit=ov2.visit, date=date_now, status="full", snapshot=snapshot.id, metadata={"something": "wicked"}, ) > swh_storage.origin_visit_status_add([ovs1, ovs2, ovs3, ovs4]) .tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:2325: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .tox/py3/lib/python3.7/site-packages/swh/storage/metrics.py:24: in d return f(*a, **kw) .tox/py3/lib/python3.7/site-packages/swh/core/db/common.py:62: in _meth return meth(self, *args, db=db, cur=cur, **kwargs) .tox/py3/lib/python3.7/site-packages/swh/storage/storage.py:864: in origin_visit_status_add self._origin_visit_status_add(visit_status, db, cur) .tox/py3/lib/python3.7/site-packages/swh/storage/storage.py:847: in _origin_visit_status_add db.origin_visit_status_add(visit_status, cur=cur) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <swh.storage.db.Db object at 0x7f1bc9c6c898> visit_status = OriginVisitStatus(origin='file:///dev/null', visit=2, date=datetime.datetime(2020, 7, 9, 8, 47, 40, 592000, tzinfo=dat...1c\x19\x00#\xbb\x99\xa3\xa3by0u"\xcb\x85\xf6', metadata=<swh.model.collections.ImmutableDict object at 0x7f1bc9c6c390>) cur = <cursor object at 0x7f1d78f47ed0; closed: -1> def origin_visit_status_add( self, visit_status: OriginVisitStatus, cur=None ) -> None: """Add new origin visit status """ assert self.origin_visit_status_cols[0] == "origin" assert self.origin_visit_status_cols[-1] == "metadata" cols = self.origin_visit_status_cols[1:-1] cur = self._cursor(cur) cur.execute( f"WITH origin_id as (select id from origin where url=%s) " f"INSERT INTO origin_visit_status " f"(origin, {', '.join(cols)}, metadata) " f"VALUES ((select id from origin_id), " f"{', '.join(['%s']*len(cols))}, %s) " f"ON CONFLICT (origin, visit, date) do nothing", [visit_status.origin] + [getattr(visit_status, key) for key in cols] > + [jsonize(visit_status.metadata)], ) E psycopg2.ProgrammingError: can't adapt type 'ImmutableDict' .tox/py3/lib/python3.7/site-packages/swh/storage/db.py:477: ProgrammingError