self = <swh.storage.tests.test_cassandra.TestCassandraStorage object at 0x7f3ca85caa90>
swh_storage = <swh.storage.cassandra.storage.CassandraStorage object at 0x7f3ca85c24a8>
sample_data = <swh.storage.tests.storage_data.StorageData object at 0x7f3ca84616d8>
def test_stat_counters(self, swh_storage, sample_data):
origin = sample_data.origin
snapshot = sample_data.snapshot
revision = sample_data.revision
release = sample_data.release
directory = sample_data.directory
content = sample_data.content
expected_keys = ["content", "directory", "origin", "revision"]
# Initially, all counters are 0
swh_storage.refresh_stat_counters()
counters = swh_storage.stat_counters()
assert set(expected_keys) <= set(counters)
for key in expected_keys:
assert counters[key] == 0
# Add a content. Only the content counter should increase.
swh_storage.content_add([content])
swh_storage.refresh_stat_counters()
counters = swh_storage.stat_counters()
assert set(expected_keys) <= set(counters)
for key in expected_keys:
if key != "content":
assert counters[key] == 0
assert counters["content"] == 1
# Add other objects. Check their counter increased as well.
swh_storage.origin_add([origin])
visit = OriginVisit(
origin=origin.url,
date=sample_data.date_visit2,
type=sample_data.type_visit2,
)
> origin_visit1 = swh_storage.origin_visit_add([visit])[0]
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/storage_tests.py:3014:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:892: in origin_visit_add
snapshot=None,
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/storage.py:902: in _origin_visit_status_add
converters.visit_status_to_row(visit_status)
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/converters.py:113: in visit_status_to_row
return OriginVisitStatusRow.from_dict({**d, "metadata": json.dumps(d["metadata"])})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'swh.storage.cassandra.model.OriginVisitStatusRow'>
d = {'date': datetime.datetime(2017, 1, 1, 23, 0, tzinfo=datetime.timezone.utc), 'metadata': 'null', 'origin': 'https://github.com/user1/repo1', 'snapshot': None, ...}
@classmethod
def from_dict(cls: Type[T], d: Dict[str, Any]) -> T:
> return cls(**d) # type: ignore
E TypeError: __init__() missing 1 required positional argument: 'type'
.tox/py3/lib/python3.7/site-packages/swh/storage/cassandra/model.py:45: TypeError
TEST RESULT
TEST RESULT
- Run At
- Jan 12 2021, 6:34 PM