Page MenuHomeSoftware Heritage

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

TEST RESULT

Run At
Jul 9 2020, 10:49 AM
Details
self = <swh.storage.tests.test_storage.TestStorage object at 0x7f1badf4ba20> swh_storage = <swh.storage.validate.ValidatingProxyStorage object at 0x7f1badeaef60> def test_origin_visit_get_by(self, swh_storage): origin_url = swh_storage.origin_add_one(data.origin) origin_url2 = swh_storage.origin_add_one(data.origin2) visit = OriginVisit( origin=origin_url, date=data.date_visit2, type=data.type_visit2, ) origin_visit1 = swh_storage.origin_visit_add([visit])[0] swh_storage.snapshot_add([data.snapshot]) swh_storage.origin_visit_status_add( [ OriginVisitStatus( origin=origin_url, visit=origin_visit1.visit, date=now(), status="ongoing", snapshot=data.snapshot["id"], ) ] ) # Add some other {origin, visit} entries visit2 = OriginVisit( origin=origin_url, date=data.date_visit3, type=data.type_visit3, ) visit3 = OriginVisit( origin=origin_url2, date=data.date_visit3, type=data.type_visit3, ) swh_storage.origin_visit_add([visit2, visit3]) # when visit1_metadata = { "contents": 42, "directories": 22, } swh_storage.origin_visit_status_add( [ OriginVisitStatus( origin=origin_url, visit=origin_visit1.visit, date=now(), status="full", snapshot=data.snapshot["id"], > metadata=visit1_metadata, ) ] ) .tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:2031: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ .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 0x7f1badf58160> visit_status = OriginVisitStatus(origin='file:///dev/null', visit=1, date=datetime.datetime(2020, 7, 9, 8, 47, 38, 929208, tzinfo=dat...f?\x10\xd1fqK\xc9\x05\x81\xde\xbf\xd0Dm\xdaW', metadata=<swh.model.collections.ImmutableDict object at 0x7f1b968b4ac8>) cur = <cursor object at 0x7f1d78f47ce0; 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