self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7f36bc041da0>
swh_storage = <swh.storage.validate.ValidatingProxyStorage object at 0x7f369c51f048>
def test_origin_visit_get_random(self, swh_storage):
swh_storage.origin_add(data.origins)
# Add some random visits within the selection range
visits = self._generate_random_visits()
visit_type = "git"
# Add visits to those origins
for origin in data.origins:
origin_url = origin["url"]
for date_visit in visits:
visit = swh_storage.origin_visit_add(
[
OriginVisit(
origin=origin_url,
date=date_visit,
type=visit_type,
status="ongoing",
snapshot=None,
)
]
)[0]
swh_storage.origin_visit_status_add(
[
OriginVisitStatus(
origin=origin_url,
visit=visit.visit,
date=now(),
status="full",
snapshot=None,
)
]
)
swh_storage.refresh_stat_counters()
stats = swh_storage.stat_counters()
assert stats["origin"] == len(data.origins)
assert stats["origin_visit"] == len(data.origins) * len(visits)
> random_origin_visit = swh_storage.origin_visit_get_random(visit_type)
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/test_storage.py:1455:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:981: in origin_visit_get_random
visit_status = self._origin_visit_apply_last_status(visit)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.cassandra.storage.CassandraStorage object at 0x7f36bc048ef0>
visit = {'date': datetime.datetime(2020, 5, 5, 21, 5, 15, 816000, tzinfo=datetime.timezone.utc), 'metadata': None, 'origin': 'file:///dev/null', 'snapshot': None, ...}
def _origin_visit_apply_last_status(self, visit: Dict[str, Any]) -> Dict[str, Any]:
"""Retrieve the latest visit status information for the origin visit.
Then merge it with the visit and return it.
"""
> visit_status = self._cql_runner.origin_visit_status_get_latest(
visit["origin"], visit["visit"]
)
E AttributeError: 'CqlRunner' object has no attribute 'origin_visit_status_get_latest'
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:866: AttributeError
TEST RESULT
TEST RESULT
- Run At
- Jun 17 2020, 10:13 AM